RFC 2822, 3.6.2 error when sending email using Laravel - laravel

I'm sending an email using Laravel:
$userAndEmail = '"' . $user->name() . '" <' . $user->email . '>';
Mail::to($userAndEmail)->send(new UserCreated($user, $userUnencryptedPassword));
This is returning the following error message:
Address in mailbox given ["Bob asdf" <rava#gmail.com>] does not comply with RFC 2822, 3.6.2.
This works if $userAndEmail is just an email address, such as rava#gmail.com. Any tips on what might be wrong?
Thanks

Related

Laravel Dusk Visit method keeps going back to APP_URL

I have the following on my TimelineTest Dusk file
$browser->visit('/wall/' . $this->username . '/' . $this->userID)
->assertTitleContains($this->username . ' - SiteName');
But although I am specifying the url to visit, my test fails because Dusk still visits the root / and not the url I specified /wall/' . $this->username . '/' . $this->userID
I dumped the current url using
$url = $browser->driver->getCurrentURL();
dd($url);
And it is the correct one, but my assertion fails saying that my title was not found in the page title, which corresponds to the one in the index page /
Did anyone have Dusk not visiting the URL they specified?

Logging route parameter/request variables

Currently I'm logging errors in my app/global.php with:
Log::error($exception . ' - ' . Request::url());
For the most part the stack trace is enough to find an fix issues however there are times where I need to know what request variables (post/get) or route parameters are being sent. What is the proper way of retrieving these variables so I can log them for debugging?
Thank you.
You can get all input variables using the Request facade as well.
Request input including files
Request::all();
Request input without files
Request::input();
To help some people out here is the full debug
Log::error($exception . ' - ' . Request::url());
Log::warning('[DEBUG] [Input] ' . implode(' / ', Request::all()));
if(Route::current())
Log::warning('[DEBUG] [Route] ' . Route::current()->uri() . ' - ' . implode(' / ', Route::current()->parameters()));

special character in message are encoded when it's delivered

I'm using Laravel-4-Nexmo package to send sms but the message is encoded on delivery .
$receiverNumber = "xxxxxxxxxxx"
$message = "hi from nexmo ? ";
$options = array( 'status-report-req' => 1 );
$Nexmo = Nexmo::sendSMS('me', $receiverNumber , $message , $options);
and received message looks like this :
hi+from+nexmo+%3F+
I would like to receive as
hi from nexmo ?
I look forward to see what could be the solution
Probably the mentioned package does not encode the given message so you should use urlencode($yourString) before using the pacckage
I do not know what was wrong with my code above, and I decided to use similar package and it works now. you can find the package here https://github.com/Artistan/nexmo

On line email form hangs on php mail() function. What server issue could be causing this?

I have a contact form on my website that has a dead simple php mail() function. I am 99% certain the php is not the issue as I have the exact same function on other sites that works fine.
However, when I try to use the form on one site in particular it seems to hang and not send the email and not redirect to the success page. Would anyone know what could be causing this on the server side?
If anyones interested my php is:
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$company = $_REQUEST['company'] ;
$phone = $_REQUEST['phone'] ;
$message= $_REQUEST['message'] ;
$webmaster_email = "myemail#mysite.com";
$thankyou_page = "http://www.mysite.com/thanks-for-your-inquiry.html";
mail( "$webmaster_email", "Site Form", "From: noreply#mysite.com",
"From: $email \n
Name: $name \n
Phone: $phone\n
Message: $message\n ");
header( "Location: $thankyou_page" );

How to remove U and Y characters for text messages to self?

If I send a text message to my phone via php mail() function, I see a character U after the Subject and Y after the body copy of the email sent. How do I get rid of these letters from the text message?
So, the text message is coming to me like this: Subj:TestingUHello WorldY
I send it with the Subject: Testing and the body: Hello World
Updated with code here:
$headers = 'From: testing#yahoo.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail('myphonenumber#sms.mycricket.com', 'Testing', 'Hello World', $headers);
Above is the code I am using, and it is producing the undesired results as described above. How do I get rid of Y and U characters?

Resources