Sending emails via gmail, Laravel - 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!

Related

stream_socket_enable_crypto(): Peer certificate

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!

My AWS SES account got suspended since somebody used my SMTP credentials for spamming

I have a Laravel 7 based application that lets people sign up for an event. I have used AWS for hosting the application and AWS SES for sending emails. After a couple of days of setting up this application, AWS suspended my SES service saying that somebody spamming using the sender email account I have used in the Laravel App for sending emails.
When I checked the SES dashboard I was able to see that there were 50000+ emails sent from that email address without my knowledge. I'm using SES for a long time in my other applications and never faced such an issue. This is something new for me. This is my first Laravel App and hence I'm not sure how the spammers got the SMTP credentials from my code. I'm storing SMTP credentials in the .env file and using bitbucket as the repository. It is a private repository only. One mistake I did was I accidentally pushed the .env file of the Application to the bit bucket repository but which is a private repo.
Does anybody have similar experiences with Laravel and SES? Anybody got a hint of what I'm doing wrong here?
I later realised that I have accidentally stored a copy in the .env file. I removed it from there and it resolved the issue.

Sudden self signed certificte problem in multiple environments

I am using Laravel and am trying to send email using Mailgun and Laravel's native Mailable class. The emails are generated as a result of submitting one of several forms. I have been developing my features for a couple of days, and have successfully been receiving emails from my local machine (using homestead) throughout this time.
I have uploaded my code to a server, tested the forms, and everything is still good. Additionally, a colleague of mine has downloaded the code and tests are still successful. So in short, 2 local homestead environments and one ubuntu server are all working as expected.
Suddenly, this functionality has stopped working in all three environments. Upon submitting any form, I get the following error message:
GuzzleHttp \ Exception \ RequestException
cURL error 60: SSL certificate problem: self signed certificate in
certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
This has started happening without any changes being made to the code, and is happening on both the local environments and the server - all at the same time.
I have absolutely no idea what could cause this. Is this mail related and something to do with Mailgun? Is this really a certificate issue and maybe something to do with a corporate certificate that allows traffic to leave the network? I am at a loss.
Is anyone able to offer any advice?
Thanks
Well, after a good night's sleep, I returned this morning and found all my forms working again. I have no idea what the problem was, but it seems to be a problem with an external service, not my setup.
Thanks

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