Laravel Mail - Use special character in Sender's Name - laravel

I use Laravel 5.8.
And what I'm trying to do is to send an email with sender's name which contain special character such as TheTh#nos. And it is not working. The email was sent, but the sender's name will not displayed.
This is my code:
Mail::send('emails.purchase-token', $data, function($message){
$message->from('noreply#thetanos.com', 'TheTh#nos');
$message->subject('New Tokens Have Been Added To Your Wallet');
$message->to("recipient01#gmail.com);
});

I'm pretty sure this is because of how gmail (and most modern e-mail clients) work.
When you put a # symbol in the From header field, the email client thinks that you're attempting to spoof the mail to make it look like it originated from a different e-mail address, even though TheTh#nos isn't a valid e-mail address.
Try using other special characters in your from and see if that works.
Also, some hosting providers doesn't allow you to change the From header when using their SMTP server.

Related

I got this error when i shoot the mail through mailgun.org in laravel8

Expected response code 354 but got code "421", with message "421 Domain sandbox4412497ba418406ba96c4a5332029424.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.
Like the message says you are using the test domain in mailgun.com. When using test domains you must add email addresses that are allowed to receive emails.
You can go to domain settings in mailgun add add recipient address to "Authorized Recipients".

Why I When I using mailgun for sending from yahoo mail or sending to yahoo mail it not works?

when i using gmail email it can be reset and set the from recipents
but when using yahoo mail the set from doent send and reset to yahoo address was error with
Expected response code 250 but got code "554", with message "554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings. "
Did you check out this page?
If this is the cause you could try sending an text-only e-mail for testing purposes, see if that does works.

How to get read receipts in Codeigniter Using GMail SMTP?

I want to add read receipts function on email send using GMail smtp in Codeigniter. How can I do that? I searched in google and it's only have for pure PHP Mail Function and PHPMailer. But i don't want to use phpmailer plugin. So help me to do with Codeigniter Mail function. Thanks.
you can use the CodeIgniter function to add some extra header in your email:
with Read-Receipt-To: , X-Confirm-reading-to: or Disposition-Notification-To: headers and you put your email or your compagny name followed by your email for the value.
The fonction is $this->email->set_header($header, $value);
But be careful, it doesn't works everytime because of web services security boxes, sometimes they don't let these headers to return to the value's email adress put.

Laravel - How Do You Check If Current E-Mail Configuration is Valid Without Sending an E-Mail?

I've written a custom provider that overwrites the e-mail configuration settings in mail.php with values populated from a database. I have a feature in my app that lets users tests the e-mail configuration entered into the system.
I can test whether current credentials are valid by calling Mail::send(). If the configuration isn't valid, the send() method will return a reason on why sending the e-mail failed.
Is there anyway for me to check configuration without actually sending an e-mail?
You can use Mail::fake(); that doesn't send the email.
In you /config/mail.php set email driver from smtp to log. I usually do it in .env
MAIL_DRIVER=log
Then send the mail as usual. You'll get a log with your email in it in /storage/logs/laravel.log This would be the easiest method. Further you can use services like mailtrap.io or mailthief

Spring mail MimeMessage has an incorrect "From " set

I am using spring mail to send an email via google's smptp server. I am setting my email templates "From" header but for some reason when I do receive the mail as a sender I get the owner of the smtp account. (which happens to be me again).
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message);
helper.setText(forgottenPassowrdMailTemplate.getText()
.replace("%firstName%", token.getUser().getFirstName())
.replace("%lastName%", token.getUser().getLastName())
.replace("%link%", url + token.getToken()), true);
helper.setTo(token.getUser().getEmail());
helper.setFrom(forgottenPassowrdMailTemplate.getFrom());
helper.setSubject(forgottenPassowrdMailTemplate.getSubject());
am I forgetting something ? I a am explicitly setting the "From" header
You are setting a from address that is different from the account's address. There are security measures by Google to avoid abuse, which could be fatal if you could just send with any arbitrary from address via Google's SMTP server. You need to link and verify your other account with the account you want to send the mail with. See here. Your original email address will still be available in the headers and visible to the receipient.
But why don't you just use the other accounts credentials (and mail server, if it is not a Google account)?

Resources