Laravel 5.6: sending email to BCC without adding email in TO() - laravel

How to send email to only bcc() without to().
When I tried, I got error
Error Information.
URL: http://example.com Parameters: [] Request Name: Request Method:
GET Line Number: 309 File:
/var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
Client IP: 127.0.0.1 HTTP Referer: Is Secure: Is Ajax: userAgent:
Symfony content: Error Message: Whoops! There was an error.
ErrorException (E_WARNING) Illegal string offset 'address'
ErrorException thrown with message "Illegal string offset 'address'"
Stacktrace: #38 ErrorException in
/var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:309
#37 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:309
Sending email to all bcc without using to

Related

Laravel backend doesn't send data to Vuejs frontend. how I resolve this?

I used vuejs frontend and Laravel backend for my application. It perfectly worked on Localhost. but when I deployed in shared hosting, it says this error on the browser console log
vue-resource.esm.js:996 GET http://regback.dazkon.com/api/getStudent 500 (Internal Server Error)
/student:1 Uncaught (in promise)
e {url: 'http://regback.dazkon.com/api/getStudent', ok: false, status: 500, statusText: 'Internal Server Error', headers: e, …}
body: {message: 'Class "PDO" not found', exception: 'Error', file: '/home2/dazkonco/regback.dazkon.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php', line: 1431, trace: Array(51)}
bodyText: "{\n \"message\": \"Class \\\"PDO\\\" not found
headers: e {map: {…}}
ok: false
status: 500
statusText: "Internal Server Error"
url: "http://regback.dazkon.com/api/getStudent"
data: (...)
[[Prototype]]: Object

SOAP: HTTP Error 400. The request has an invalid header name

I am making a SOAP call with using a Ruby On Rails gem Savon and when making a request, I get this error message:
Bad Request - Invalid Header
HTTP Error 400. The request has an invalid header name.
It sounds pretty descriptive, but I am still not able to figure out the problem. I also found a few topics here on SO, but none of them has unfortunately helped me.
Here's how I do make the connection:
client = Savon.client(endpoint: wsdl_url,
namespace: '',
env_namespace: :s,
basic_auth: ["username", "password"],
ssl_verify_mode: :none,
log: true,
logger: Rails.logger,
pretty_print_xml: true)
#response = client.call('MyAction',
soap_action: 'url address',
xml: xml_payload,
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8',
})
And here's the generated error from the (terminal) console:
SOAP response (status 400)
<?xml version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"/>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</hr></BODY>
</HEAD>
</HTML>
If I change the header config from this:
#response = client.call('MyAction',
soap_action: 'url address',
xml: xml_payload,
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8',
})
to this:
#response = client.call('MyAction',
soap_action: 'url address',
xml: xml_payload)
The error message says a lot less:
Savon::HTTPError - HTTP error (400):
So the header makes it a bit more descriptive. If I look at the headers generated by Savon, it looks like this:
SOAP request: https://URL_ENDPOINT
Content-Type: application/soap+xml; charset=utf-8, SOAPAction: "http://URL_ENDPOINT/MyAction", Content-Type: text/xml;charset=UTF-8, Content-Length: 2935
What headers are wrong? How do I debug/inspect it here?
I also tried to investigate this issue in Postman and got only this error message:
400 Bad Request - The request cannot be fulfilled due to bad syntax.
I also tried to validate the generated XML data I send to the server - and that's valid (verified on different validators).
How do I solve this problem?
Thank you

"The GET method is not supported for this route. Supported methods: POST" message in my laravel API

I followed a tutorial to do a login page with an external api, but my API is not working.
In the localhost http://localhost:8000/api/auth/login appear "The GET method is not supported for this route. Supported methods: POST." and in the Chrome DevTools
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message: "Http failure response for http://127.0.0.1:8000/api/auth/register: 422 Unprocessable Entity"
name: "HttpErrorResponse"
ok: false
status: 422
statusText: "Unprocessable Entity"
url: "http://127.0.0.1:8000/api/auth/register"
I use laravel 6,php 7, ionic 4
Please, help me!
(tutorial is: https://blog.flicher.net/laravel-rest-api-passport-authentication-for-ionic-app/)
If you follow the tutorial in section Step 6 — Set API routes it list down all routes for api.
Here it says as below
File: api.php
Route::group([
'prefix' => 'auth'
], function () {
Route::post('login', 'Auth\AuthController#login')->name('login');
});
That means we have a route with name as login which would be a POST request and url would be api/auth/login as it is api.php file.
You are calling it from the browser, that would be a get request, which is not found by laravel in routes, so it is generating this error.
Reference: Laravel Routing

CI Session Not Wokoring After Change Email Codeigniter/Tank Auth

Hi I have my session set to true in codeigniter I use tank auth but when I go use my change email form. after re activating new email got to success page but loads up errors but when I view my database users table email has changed.
The errors that I am showing are.
A PHP Error was encountered
Severity: Notice
Message: Undefined index: session_id
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: ip_address
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: user_agent
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: last_activity
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: session_id
Filename: libraries/Session.php
Line Number: 288
A PHP Error was encountered
Severity: Notice
Message: Undefined index: last_activity
Filename: libraries/Session.php
Line Number: 289
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/cws01/public_html/tank/system/core/Exceptions.php:185)
Filename: libraries/Session.php
Line Number: 675
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/cws01/public_html/tank/system/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 542
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Most likely it is due to the sess_destroy() initiated by a logout in Tank_auth
Following code in logout function within the Tank_auth library worked for me.
function logout()
{
$this->tank_auth->logout(); // Destroys session
$this->ci->session->sess_create();
redirect('/auth/login');
}
See: Post on ellislab-forum; and this forum..

Google PHP API Offline Access Issue

I am trying to use Google PHP API to sream contents from Google plus. I was able to get the refresh token. But when I tried to get access token using that refresh token, its returning the following error.
Fatal error: Uncaught exception 'apiAuthException' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php:242 Stack trace: #0 /var/www/social-media-test/google-api-php-client/src/apiClient.php(281): apiOAuth2->refreshToken('MY-REFRESH-TOKEN-HERE') #1 /var/www/social-media-test/google-api-php-client/examples/plus/p.php(19): apiClient->refreshToken('MY-REFRESH-TOKEN-HERE') #2 {main} thrown in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php on line 242
MY code is as shown below.
$client = new apiClient();
$client->setApplicationName('Google+ PHP Starter Application');
$client->setClientId('client-id');
$client->setClientSecret('secret-key');
$client->setRedirectUri('http://localhost/index.php/main');
$client->setDeveloperKey('dev-key');
$plus = new apiPlusService($client);
$client->refreshToken('MY-REFRESH-TOKEN');
Any Ideas?
you forgot this:
$client->setScopes(array(
'https://www.googleapis.com/auth/blogger'
));
ref: https://developers.google.com/gdata/docs/auth/oauth#Scope

Resources