Failed to authenticate on SMTP server with username "email#example.com" using 2 possible authenticators - email

I'm trying to connect to our internal MS Exchange server in order to send out emails from our Laravel application.
In the mail.php config I have the following settings:
Driver = smtp
Host = Our exchange IP address which is correct
Port = 25
Encryption = tls
The user credentials are correct but I still receive the following error:
Failed to authenticate on SMTP server with username "email#example.com" using 2 possible authenticators
We are using the full email as the username, as if we don't then SwiftMailer complains, and I receive:
Undefined offset: 1
This occurs in the getDomainAndUsername($name) method, as it's trying to explode the username using the # symbol.
Any ideas what might be going on here? Has anyone dealt with using SwiftMailer in Laravel connecting to an MS Exchange server?

Related

Sendgrid setup on SQL Database Mail

I have been trying to setup sendgrid on SQL Database Mail but all the time it says Cannot send mail to mail server.
This is what i have done.
I have sendgrid accound with abc#mydomain.com and created api key and SG.xxxx password.
As this is prod setup instance, i had done domain level authentication and my webmaster updated CNAME as requested by sendgrid.
Tested using TELNET smtp.sendgrid.net 587 and authenticated with SG.xxxx password Base64 encoded and this was able to send email from abc#mydomain.com to xyz#mydomain.com
I setup profile with abc#mydomoain.com as SQL notification Profile and selected Basic Authentication and provided 'apikey' as username and 'SG.xxx' as password in Database Mail - 'Configure Database Mail' option in SQL SSMS. Unchecked - 'The server requires secure authentication (SSL) connection' Port 587
I tried to 'Send Test Mail' with 'abc#domain.com' to 'xyz#mydomain.com' but the Database Mail reflects as below screenshot error
I have tried using abc#mydomain.com and sendgrid account password in Database Mail Config wizard for Basic authentication, but sendgrid suggested they don't accept Basic authentication. Please help how and where should i pass the api key if not under Basic Authentication ?
I tried updating with msdb.dbo.sysmail_add_account_sp nad updating records but it too didn't resolve and send email from Database mail.
Any help/ guidance would be greatly appreciated or if you had faced this how have you resolved it.
Hi the solution is as follows
Create a dbmail profile
server name: smtp.sendgrid.net
port : 25
SMTP Authentication
Basic Auth
User name: apikey
Password: : {the api-key for your sendgrid account}
Thats it. Send a test email.
If it still doesn't work, if you are on AWS EC2 ensure that security group allows outbound port:25
Here is the link from sendgrid about apikey authentication.
https://docs.sendgrid.com/for-developers/sending-email/upgrade-your-authentication-method-to-api-keys

YII2 sending email works on localhost but produce error on production server

Why is it that my application can send email when run on localhost but produce the following error on the production server. The same email is used and the same settings/codes is used.
Failed to authenticate on SMTP server with username
"myemail#sample.com" using 2 possible authenticators

HAProxy Mailer SMTP Authentication

I would like to send alerts using a mailer in HAProxy.
I tried to follow:
email-alert
The problem is that my mail server requires a SSL connection with username an password.
Any suggestions?
Solution.
Following (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-14-04) I've configured a local postfix.
HAProxy connects to this SMTP server to send mails.

VPS Mailbox setup - Mailgun and Roundcube

Im running a VPS with NGINX and PHP 7.0 and I'm trying to setup Roundcube in combination with Mailgun.
I've setup a Mailgun account and got it all working (I can receive/send emails via Mailgun).
Now I'm trying to implement Roundcube as an email client, but I cannot seem to login with the Mailgun SMTP credentials.
I keep getting the following error message:
IMAP Error: Login failed for user#domain.com from IP1.IP1.IP1.IP1.
Could not connect to IP2.IP2.IP2.IP2:587:
Connection timed out in
/var/www/webmail/program/lib/Roundcube/rcube_imap.php on line 184
(POST /webmail/?_task=login?_task=login&_action=login)
Now I'm starting to doubt if this might even work, does anyone have experience with the following setup?
Mailgun is not providing SMTP/IMAP to new users.
Maybe that's why.

Using authsmtp from a Grails server

This is quite a specific question, and I have had no luck on the grails nabble forum, so I thought I would post here. I am using the grails mail plug-in, but I think my question is a general one about using authsmtp as an email gateway from my server.
I am having trouble sending mail from my app using authsmtp. I have installed and configured the mail plugin and was originally using my ISP's SMTP server to send mails. However when I deployed to AWS EC2 this failed because my elastic IP was blocked by the SMTP host. So I bought myself an authsmtp account and set up my server email address as an accepted one at authsmtp.
I then changed my configuration in SecurityConfig.groovy to point to the authsmtp server that I had been designated...
mailHost = "mail.authsmtp.com"
mailUsername = "myusername"
mailPassword = "mypassword"
mailProtocol = "smtp"
mailFrom = "valid-authsmtp-address#mydomain.com"
mailPort = 2525
...and I'm just trying to get this to work locally before I deploy back up to AWS. Sending mail fails and in my log I have this exception:
2010-02-13 10:59:44,218 [http-8080-1] ERROR service.EmailerService - Failed to send emails: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 513 5.0.0 Your email system must authenticate before sending mail.
org.springframework.mail.MailSendException; nested exception details (1) are:
Failed message 1:
com.sun.mail.smtp.SMTPSendFailedException: 513 5.0.0 Your email system must authenticate before sending mail. at
com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
I'm a bit lost since the username and password I provide in the
configuration are definitely correct.
A terse and not very helpful conversation with authsmtp support suggests
that I need to MD5 and/or base64 encode my credentials before sending, so my
question is in three parts...
1) any idea what's going on with the failure and why that message is
appearing?
2) how would I encode the credentials to pass to authsmtp and how would I
configure that for the mail plugin
3) has anyone successfully connected and sent mail through authsmtp from the
mail plugin and specifically from AWS EC2?
When sending Email using the Acegi plugin, under the hood a Spring JavaMailSenderImpl is used. Looking at its docs:
Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified password will not be sent to the mail server by the JavaMail runtime. If you are not explicitly passing in a Session to use, simply specify this setting via setJavaMailProperties(java.util.Properties).
So append to your SecurityConfig.groovy the following:
javaMailProperties = [ "mail.smtp.auth": true]
I didn't find a solution to this using the Grails mail plugin, so I'm still interested in an answer, however I did find a workround. It may be useful in case anyone else follows me down this lonely path.