Laravel 5.7 not sending emails and not showing any error - laravel-5.7

I have to run mail function on laravel with google smtp.gmail.com or default mail() DRIVER only cant use other methods as client requirement but both not working. I tried everything that I can
I tried smtp.gmail.com and default mail() DRIVER both but no result
.env file code
With smtp
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxxx#gmail.com
MAIL_PASSWORD=xxxxxxxx
MAIL_ENCRYPTION=tls
With mail
MAIL_DRIVER=mail
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Controller code
$template_data = EmailTemplate::getEmailTemplateByID($template->id);
$email_params['verification_code'] = $user->verification_code;
$email_params['name'] = Helper::getUserName($user->id);
$email_params['email'] = $user->email;
Mail::to($user->email)
->send(
new GeneralEmailMailable(
'verification_code',
$template_data,
$email_params
)
);
It's not showing any error just showing success message that you are registered or we send recovery email but no email in inbox

you need to add mail host and mailport as these are requires to send mail.
just go through this link must resolve this issue
https://appdividend.com/2018/03/05/send-email-in-laravel-tutorial/

Related

Swift Mailer doesn't send the email?

I use Swift Mailer in Symfony 2, It appears in the profile bar that the email has been sent but it seems it was not.
Controller :
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('koorahome#gmail.com')
->setTo('hzweb4#gmail.com')
->setBody(
$this->renderView(
// app/Resources/views/Emails/registration.html.twig
'verify/email.html.twig', array()
), 'text/html'
)
;
$this->get('mailer')->send($message);
Paramaters :
mailer_transport: smtp
mailer_encryption: ssl
mailer_host: smtp.gmail.com
mailer_user: koorahome#gmail.com
mailer_password: *******
It seems your setting need set as your server problem. I mean you need to set sender same as your server.
For example, your server http://example.com than you need to create mail in your server as: name#example.com see your config in your server mail and set it in your SwiftMailer.
If your server is localhost and want to test email, use mailtrap : https://mailtrap.io/. Register, create mail test, see config for symfony and setup.
Check your Gmail settings. You may have to allow SMTP emails.
Try below:
Log into your Gmail or Google Apps email Settings and click on the Forwarding/IMAP tab. Scroll down to the IMAP Access section. IMAP must be enabled in order for emails to be properly copied to your sent folder.

SMTP server error inside SMTP Authentication Support in Drupal 7

I'm using SMTP Authentication Support in Drupal 7 to send mails. I'm getting this message in my watch dog log for some mail ids. "Error sending e-mail from example#example.com to recp#example.com : StartTLS not supported by server or could not initiate session."
What is the possible issue behind this error and how can I resolve this?
It already told you the StartTLS is not supported, call your hosting and let them turn it on. But my guess is they won't. You can use PHPMailer to send the email and don't forget $mail->SMTPAuth = true;

SMTP server error: Verification failed for 550-No Such User Here 550 Sender verify failed

I'm using
Configure SMTP plugin for wordpress, when I used it in a local server (localhost) it works properly and send me the test email which confirms that it is working. But when I used it in a hosting site (I used Hostgator) it gives me an STMP error.
What is the possible cause of this error? and what is the possible solution?
Thank you.
Based on the second error, and the words "verification failed", and "sender verify" failed, my guess would be that you have not set up SMTP authentication correctly. You are relaying your mail through Hostgator, so they may have specific hostnames / ports that you need to authenticate correctly with to get your mail to flow. I'd suggest syncing with Hostgator on this.

the server rejected one or more recipient addresses. the server response was 550 5.7.1 unable to relay

I am sending mails using our company SMTP server. I get the problem when I am sending mail to other mails (out side of the company domain), returning the error:
"The server rejected one or more recipient addresses. The server
response was 550 5.7.1 unable to relay".
If the mail is within the company, then there is no error and mail sending successfully. My web application hosted in IIS.
I'll assume that there is nothing wrong in your code. I guess it is a configuration issue i.e SMTP server configured to not send emails to addresses that are not part of your company domain. If so you need to check with your Windows/Network team to confirm configuration applied at SMTP server level.
I have Solved this problem. For using this code you need to add the namespace Using System.Web.Mail;
Source Code:
MailMessage mail = new MailMessage();
mail.To = "yourfromemail#domain.com";
mail.From = "yourtodomain#domain.com";
mail.Subject = "Email test.";
mail.Body = "Your body text here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send( mail );
//your need to add localhost address to IIS Manager.
Goto IIS Manager -> Default SMTP Server ->Properties -> Access -> Relay -> allow only from the list below -> add -> 127.0.0.1 -> Click OK

How can I configure Drupal 6 to work with gmail?

How can I configure Drupal 6 to work with gmail IMAP?
These are the errors I get when trying to send email from Drupal.
warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 23sm231165iwn.2 in C:\inetpub\wwwroot\acquia-drupal\includes\mail.inc on line 193.
Unable to send e-mail. Please contact the site administrator if the problem persists.
These are the settings in my PHP.ini file.
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 587
; For Win32 only.
sendmail_from = info#mysite.com
Thanks in advance!
Assuming you are trying to send email, the SMTP Authentication Support module is the way to go. I use the 6.x-1.x-dev version on a number of sites with no problem.

Resources