How can I configure Drupal 6 to work with gmail? - drupal

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.

Related

Error Sending mail through Gmail SMTP relay [duplicate]

This question already has answers here:
Sending email in .NET through Gmail
(26 answers)
Closed 2 years ago.
I'm working on building a contact form for my new Web site and want to send mail through Google's SMTP relay server (smtp-relay.gmail.com) because I want to set up a "dummy", "no-reply" address from which to send the mail. Also, I tried sending it through the regular SMTP server (smtp.gmail.com) using my own actual Gmail credentials for that account and it got blocked as an insecure app. I'd rather not turn on the "Less secure app access" option (it's not really an option for me anyway because I use 2FA on this account), so this seems like the best way to get there - if I can get it working.
The domain's mail is hosted in G Suite and I've configured the SMTP relay service in the Google Admin Console for my domain as per the instructions in the support article, SMTP relay: Route outgoing non-Gmail messages through Google. I have the relay configured using both the public static IP address of my Web site, as well as the static IP address of the firewall behind which the Web server lies. I configured the relay to accept mail from my domain(s) to allow for the "dummy" address that doesn't actually have a mailbox, and set it to require SMTP Authentication and TLS encryption:
I've set up DNS records for MX, SPF, and DKIM with my domain registrar.
I've waited over 24-hours for the changes to take effect (as per the notification when making the changes in the Google Admin Console)
I've even set up an app password for my Web site to use for my domain e-mail address:
I'm using an ASP.NET (VB) Web site on IIS. My code for sending looks like this:
Dim NewContact As New System.Net.Mail.MailMessage()
With NewContactMessage
.From = New System.Net.Mail.MailAddress("no-reply#mydomain.com")
.To.Add("myaddress#mydomain.com")
.Subject= "TEST MESSAGE"
.IsBodyHtml= True
.BodyEncoding = System.Text.Encoding.UTF8
.Body = "This is a test."
.Priority = System.Net.Mail.MailPriority.Normal
End With
Dim Server As New System.Net.Mail.SmtpClient()
With Server
.Port= 587
.Host= "smtp-relay.gmail.com"
.EnableSsl= True
.Send(NewContactMessage)
End With
However, when I try to submit my contact form, I get an error, Mailbox unavailable. The server response was: 5.7.1 Invalid credentials for relay [X.X.X.X]. The IP address you've:
It looks like there should definitely be more to that actual error message, but it's apparently being truncated somewhere along the way.
I've tried feeding the credentials in the SmtpClient block:
With Server
.Credentials = New System.Net.NetworkCredential("myaddress#mydomain.com", "my_app_password")
.Port= 587
.Host= "smtp-relay.gmail.com"
.EnableSsl= True
.Send(NewContactMessage)
End With
In this case, I get a different error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at. (If I use the credentials with the "default" Gmail SMTP server (smtp.gmail.com), I get the same error.)
According to the Audit Logs, it appears that all of my configuration setting changes have completed. Everything appears to be correct for this to work, but what am I missing?
Just before posting this question, I found this Q&A - Send mail via google app with smtp relay - with the simple fix to my issue: Turn off the Require SMTP Authentication option in the SMTP relay service configuration settings.
Once I disabled that setting and tried again, everything is flowing normally. I suppose I should have figured that out on my own, but according to Google's support article for setting up the SMTP relay (emphasis mine in the first sentence):
In the Authentication section, check one or both boxes to set an authentication method:
Only accept mail from the specified IP addresses — The system only accepts mail sent from these IP addresses as coming from your domains.
Require SMTP Authentication — Enforces the use of SMTP authentication to identify the sending domain. Using this option requires your clients to connect via TLS.
The wording here seems a bit misleading and appears to indicate that you can have both of these options enabled without one "interfering" with the other. As I said, I probably should have figured this out on my own - especially since I'm trying to send from a "dummy" e-mail account - but I guess it just didn't occur to me.
I considered deleting this question, but I had done a fair amount of searching before writing this question up and somehow never ran across that particular post. I'm not sure how I could have missed it, but I'm leaving my question here in hopes that someone else has an easier time of finding this solution in the future.

Try to use Symfony mailer with Gmail

Try to use Symfony mailer with Gmail on my Symfony 5.1 app.
mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
.env:
MAILER_DSN=gmail+smtp://myadresse#gmail.com:mypassword#localhost
But each time I send a mail, I got:
Connection could not be established with host "ssl://smtp.gmail.com:465": stream_socket_client():
SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Don't understand why... According to the https://symfony.com/doc/current/mailer.html it should work.
I activated low security app on my Gmail account.
Thanks for help
To use Gmail, you need the package symfony/google-mailer (composer require symfony/google-mailer)
And this configuration in your .env file:
###> symfony/google-mailer ###
# Gmail SHOULD NOT be used on production, use it in development only.
MAILER_DSN=gmail://YourEmailAddress:YourPassword#default?verify_peer=0
###< symfony/google-mailer ###
An example:
MAILER_DSN=gmail://stackoverflow#gmail.com:admin123#default?verify_peer=0
Warning:
Although it’s not recommended to disable this verification for
security reasons, it can be useful while developing the application or
when using a self-signed certificate
I know you've said you've done it, but I usually get this error because I need to allow "less secure apps" on my Gmail account.
Connect to Gmail
Go to https://www.google.com/settings/security/lesssecureapps and click Authorize
Go to https://accounts.google.com/DisplayUnlockCaptcha and click Continue
Retry sending an email from your website, and if it still doesn't work repeat points 2 & 3. Sometimes I have to try a few times...
That can come from an async property that is defined by config/packages/messenger.yaml
see https://github.com/symfony/symfony/issues/45811
You need to make sure you are using an SSL certificate when sending emails through Gmail.
See:
https://symfony.com/doc/3.0//email/gmail.html

Laravel 5.7 not sending emails and not showing any error

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/

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.

Resources