stream_socket_enable_crypto(): Peer certificate - laravel

I am trying to connect private email with my Laravel project.
.env configuration below
MAIL_DRIVER=smtp
MAIL_HOST=mail.privateemail.com
MAIL_PORT=587
MAIL_USERNAME=contact#myDomainName.com
MAIL_PASSWORD=myPrivateEmailPassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=contact#myDomainName.com
MAIL_FROM_NAME=MyCustomName
After this , I run this three command,
php artisan config:clear
php artisan config:cache
php artisan queue:restart
I have too many EmailJob files to send emails. That's why I used the last command.
What I am getting the error?
{"status":500,"data":"stream_socket_enable_crypto(): Peer certificate CN=`111-11-11-227.cprapid.com' did not match expected CN=`mail.privateemail.com'"}
Note: 111-11-11-227 is the fake number I gave here. Because I need to keep it private.
Laravel 5.8

You're getting the error because you are asking it to connect to a server called mail.privateemail.com, but you are actually connecting to a server called 111-11-11-227.cprapid.com. TLS is specifically designed to reject connections when certificate names don't match, protecting you from servers that are pretending to be something they are not.
There are several likely explanations for this.
You have the wrong name for the mail server, and you're being redirected to the right name, but it results in a name mismatch
Your server name is correct, but your hosting provider is redirecting traffic to their own mail server as a spambot prevention tactic
Some bad actor is intercepting your traffic and redirecting it to their own mail server (in which case, TLS is doing its job) in the hope of tricking you into revealing credentials
If it's 1, simply change your config to use at the correct server. If its 2, perhaps point directly at your hosting provider's mail server – their docs should tell you what to do. If it's 3, count yourself lucky that we have TLS to protect our traffic and report it to your provider!

Related

Laravel 8.x Email Simulation for Testing

I want to simulate email send/receive on a Laravel 8.x app, something like using Insomnia or Postman to test REST feature by sending to an endpoint. What I want to do is to send the email to the app, and debug the app processing the email it received, all of them running on a local VM (CentOS 8), without having to send emails using my actual account.
Not much info in the Internet, and results are usually for sending out from Laravel app. Could it be that my scenario is not possible?
if I got your requirements correctly, you could use a mail server like Mailu
run an email server on a docker container
connect your laravel app to the mail server using SFTP
send your email details to your laravel app via HTTP
process your email content or debug it in laravel
send the email to the mail server
or If you received an email in that mailbox, you can get the mails with laravel and process them.
I hope this help.
Not sure if I understand, but you can use Mailhog which is an email-testing tool with a fake SMTP server underneath. MailHog runs a super simple SMTP server that hogs outgoing emails sent to it.
All outgoing emails will be trapped by MailHog, being pretty useful in order to avoid sending emails accidentally when developing.
I've asked (and finally found a solution) in this question:
Auto boot MailHog on Ubuntu 20.04 about how to use it in a staging evironment, but running locally with no need to auto start the service is even easier.
There are tons of tutorials about how to implement MailHog and Laravel.

Sending emails via gmail, Laravel

can anyone know if there is any difference in sending emails via gmail in Laravel 5.5 on localhost and on global server, because on localhost everything works fine, emails are sent without problem but on global server all the time crashes my authentication error go on configuration connection does not change. Of course, I have enabled mail access for less secure applications. I wonder if it's a problem with mail or a change of environment, from local to global, or something else must change in the .env file configuration or directly in the application. Thank you in advance for your help
Yes. Possibly it occurred because of app environment. Try keeping debugging on. And trace back the authentication error. Try sending dummy email with simple text.
And after making changes in env file empty config caches using php artisan cache:clear. Many times config doesn't change because of caching.
Good Luck!

Mandrill SMTP with Swiftmail in Laravel - works local, breaks on hosting

When users are registered Laravel fires of a welcome email using Swiftmail configured to use SMTP with Mandrill. With the existing config, this works perfectly on my local installation.
When moving to the production server (Unmanaged, CentOS with WHM/Cpanel), the first HELO fails, giving this error:
Swift_TransportException in AuthHandler.php line 181:
Failed to authenticate on SMTP server with username "info#mydomain.com" using 2 possible
authenticators
in AuthHandler.php line 181
at Swift_Transport_Esmtp_AuthHandler->afterEhlo(object(Swift_SmtpTransport)) in
EsmtpTransport.php line 307
All other questions I can find with this error are about Gmail needing to have it's authentication weakened to allow the connection. This is directly with Mandrill so such things can't be the issue.
I've already checked the correct port (578) is open - nmap says it is.
That the credentials in mail.php are valid - API key is correct, so is user information.
And that the server can access the remote server - I can telnet smtp.mandrillapp.com without issue.
I'm running out of things to test for to fix.
Any suggestions welcome, and thank you in advance!

Laravel 5 mailgun works locally (Mac OS) but nothing happened on live server

I developing a web application using Laravel 5, application needs send email to members when they registered.
I use mailgun as mail driver, everything works fine locally on my Mac Book Pro machine, it means everything should configured correctly, but when I move to Ubuntu server (14.04), the mailgun didn't send any email out neither any error message.
I tried using curl command on server, it works fine, means server should not block any port for mailgun.
Anyone please can help on this issue?
As this works from one environment, and not in another, it's very likely to be a configuration problem. This might differ in a few places with mail in Laravel.
You'll need to check that pretend in config/mail.php is set to false. See here.
You'll need to make sure your .env file (if you're using .env) is first renamed from .env.example to .env and then check that the settings are set up correctly for Mailgun. I wrote a small tutorial for Mailgun Laravel 5 here if you have any problems with that.
You'll need to check that the third party services file in config/services.php is configured correctly. More specifically, you need to ensure that the API key is set up correctly.
If none of these work correctly, then you'll almost certainly have some error message in your storage/logs folder, I recommend checking here for some hints.
Most of the time this happens due to wrong env configuration try this one. You can simplify the confusion between the Mail.php and .env settings

Magento order emails not sending

When people place an order on my online store I am not receiving a notification email. The customer isn't receiving order emails either.
I am able to send emails to customers (their order details, password updates, etc.) manually, but we're not receiving any order notifications automatically.
Under Sales Emails, I have my email address (same domain as store url), and copy method separate email. I've done this for all sales emails. All other sending options are default (disable email communications: no, host: localhost, port: 25, set return path: no).
If anyone has any suggestions I'd love to hear them :)
Thanks in advance,
Bob
1.
Mail Sending Settings:
host: localhost
host may vary from one server to other server sometimes, check whether your host is localhost or any other. My server is not using localhost.
2.
Compilation may be enabled in your server. So your settings will not be affected untill you run the compilation after made any changes in your server. You may check the mail issues after disable compilation.
3.
If all fine and mail still not working, then you can try this free extension CheetahSender.
First you need to check with php mail at your server i am sure that your server mail is disabled or somehow its not working.. so check it by simple mail function of php at root directory and then after check with magento..
You probably did not install the sendmail in your server. Type:
sudo apt-get install sendmail
If all other emails are working then check with cron job. in magento 1.9 its based on cron job. so you can trace through..

Resources