I'm trying to send an email to swiftmailer with symfony 2.8.
Before 2 months I was able to send emails without problems.
But since one week, I'm not able to send an email.
I tried all these solutions but the issue persists:
- allow less secure app Gmail
- change port from 465 to 587
- trying both mailer_transport SMTP and Gmail
but nothing works.
Any help, please?
Error :
Connection could not be established with host smtp.gmail.com [ #0]
500 Internal Server Error - Swift_TransportException
code :
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('mohamed.maddouri#esprit.tn')
->setTo('mohamed.maddouri#esprit.tn')
->setBody("test mail")
;
$this->get('mailer')->send($message);
Related
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/
I face a problem I don't understand.
I use SwiftMailer to send emails (ex : registration confirmation) from a website using the Mailjet SMTP. Mails are not sent.
The Symfony profiler says that 1 mail is spooled when I create a user account, but it is never sent.
php bin/console swiftmailer:spool:send returns 0 emails sent. I tried memory and file spools.
When using the php bin/console swiftmailer:email :send, mails are correctly sent (mails have the mailjet headers and they are in the mailjet sent mails interface).
When I'm trying the OVH SMTP, mails are correcly sent both from the application and cli command, so the problem seems to be a SwiftMailer misconfiguration.
Here is my setup :
app/config/config.yml
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host_prod%"
port: "%mailer_port_prod%"
encryption:"%mailer_encryption_prod%"
username: "%mailer_user_prod%"
password: "%mailer_password_prod%"
spool: { type: memory }
app/config/parameters.yml
mailer_transport: smtp
mailer_host_prod: in-v3.mailjet.com
mailer_port_prod: 587
mailer_encryption_prod: tls
mailer_user_prod: api_key
mailer_password_prod: api_secret
mailer_host_ovh: ssl0.ovh.net
mailer_port_ovh: 465
mailer_encryption_ovh: ssl
mailer_user_ovh: email
mailer_password_ovh: password
It works for me. I had the same issue, but I had an exit after sending the email and in this case, the spool doesn't send the email, because the kernel does not end properly. If you remove spool: { type: memory }, then it will send the email.
To send the email properly with spool, then you need to end the kernel properly.
Did your request finish without any errors when creating the message ?
On https://symfony.com/doc/current/email/spool.html : "This means the email only gets sent if the whole request got executed without any unhandled exception or any errors."
Finally, it was the sender's email who was wrong. I forgot to update it after going prod.
At this moment, Mailjet successfuly receive the email but put it in queue and don't send it. On Symfony side, it is a success.
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;
I have moved an application to amazon builded in symfony2 and using swiftmailer for sending emails, I am not able to send emails from the application.
So searching around the solution for sending emails. Please let me know if any solutions for sending email SES or configuring SMTP for symfony2.
I got mine to work with the following details:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
auth_mode: login
encryption: tls
port: 587
logging: "%kernel.debug%"
And lastly, make sure the send FROM email address is verified.
I never played with AWS SES but you can use mailjet to send email. You just need to configure Swiftmailer Transport to use their SMTP and you're done.
They also ensure that your email are well sending (ie: not in spam) by providing several technique. You will have to setup some of them.
They do not provide example for Swiftmailer, but here a good one for Zend (you will see how easy it is):
$config = array(
'ssl' => 'ssl',
'port' => 465,
'auth' => 'login',
'username' => 'your_Mailjet_API_Key',
'password' => 'your_Mailjet_Secret_Key');
$transport = new Zend_Mail_Transport_Smtp('in-v3.mailjet.com', $config);
$mail = new Zend_Mail();
$mail->setFrom('your_sender#address.com', 'You');
$mail->addTo('recipient#example.com', 'Anybody');
$mail->setSubject('My first email by Mailjet');
$mail->setBodyText('Hello from Mailjet & Zend Framework !');
$mail->send($transport);
Amazon SES has an excellent Php API from the official AWS Php SDK:
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-ses.html
As you can see, SES is not used as a SMTP gateway (like Mailjet does) but as a HTTP API (via Guzzle, a Php library for HTTP queries). It's always an important decision to rely or not on Amazon services such as S3/SeS/SNS etc... maybe you don't want to depend on no Amazon technology?
You can try to use AWS SES Monitor Bundle to manage the sending of emails through SwiftMailer with Symfony.
The problem is that when you start with AWS SES you are in the sandbox and to go live you need to file an issue to Amazon to ask to put you out of the sendbox.
The requirement is that you can manage bounces and complaints.
To get notifications about those, you need to connect to Simple Notification Service (the other option is to get notifications via e-mail).
To automate all this stuff, you can use AWS SES Monitor Bundle that do all of this for you.
It also registers a plugin for SwiftMailer that can intercept messages and avoids the sending of messages to address to which you should not send e-mails.
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.