Using authsmtp from a Grails server - email

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.

Related

#61042 - An error occurred while processing the outgoing email message with subject "RE: test "

I have installed email router server on production server where Dynamics crm has been installed but when try to reply any mail, the result shows pending send and an error shows in event viewer. I am trying to send mail using a SMTP Relay server. Although, the same application with in same domain and same settings on testing server is working fine.
The event viewer error log is as given below.
Description:
61042 - An error occurred while processing the outgoing email message with subject "RE: test " for SMTP: http://172.26.4.123/TESTCRM for
delivery through 172.26.4.124.
System.Security.Authentication.AuthenticationException: The remote
certificate is invalid according to the validation procedure.
Please suggest some solutions.
Welcome to StackOverFlow.
Hope you are doing well. Let try some steps to troubleshooting the issue:
Set the E-mail Router Outgoing profile to Anonymous.
a. Launch the Microsoft Dynamics CRM 2011 E-mail Router.
b. Open the Outgoing SMTP profile.
c. In the Authentication Type drop down, choose Anonymous.
d. Click Publish.
Updated the settings for the outgoing profile of the email router to use SSL and matched the name of the SMTP server with the name of the certificate. In this case, the proper name was the FQDN of the Exchange server.
** SSL for SMTP is not supported in Ex2010, so if this is your escenario then: unchecked “SSL” for SMTP, saved CRM router settings.
Please find below articles regarding your issue.
https://support.microsoft.com/en-us/help/954584/error-message-when-you-try-to-test-access-from-the-microsoft-dynamics
https://community.dynamics.com/crm/f/117/t/99471
https://community.dynamics.com/crm/f/117/t/231301
Dynamics CRM Email Router Troubleshooting 101 – Outgoing Emails

SSL for mail server

I don't know if I am asking this in the right place.
I have an SSL cert for my website, and I am trying to setup a mail server (same domain) using the same cert.
I am using Postfix and Dovecot. When I try logging in from Evolution mail client, I get an error "Peer failed to perform TLS handshake". When I try an online service to verify I get "Recipient address rejected: User unknown in local recipient table."
I guess my actual question is, can I actually use the same SSL cert for my website and my email server?
What do I do to debug next?
You can use a certificate you have for the web server also for your mail server as long as it matches the hostname you use to access your mail server. Of course the certificate need to properly setup at the mail server, i.e. include the necessary intermediate certificates similar to how it is (hopefully) setup on the web server.
I am using Postfix and Dovecot.
This means you need to take care of multiple configurations, both for SMTP in Postfix and IMAP/POP3 (whatever you use) in Dovecot. And in all cases the certificates subject/SAN must match the hostname you use to connect to the server.
When I try logging in from Evolution mail client, I get an error "Peer failed to perform TLS handshake".
There are not enough information about this setup to find out what exactly is causing the TLS error. It is not even clear if the error is caused when retrieving mail (IMAP/POP3, i.e. Dovecot) or while sending (Postfix).
When I try an online service to verify I get "Recipient address rejected: User unknown in local recipient table."
This has nothing to do with TLS at all. The test server simply tried to use a recipient which your mail server (Postfix) will not accept.
What do I do to debug next?
The next steps would probably be to check if the certificate matches the names you use in the first place and to look into log files for error messages or warnings. Following steps depend on what the result of these steps is.

Sender dependent relaying on Zimbra 8.7? Can it be done?

I had a server running Zimbra 8.6 and it was configured to send via any one of five external relays based upon which one of my external accounts I was sending from. This worked great until I had a server crash and rebuilt this one using the latest Zimbra 8.7.
I have read and researched and tried everything I had done for my old 8.6 system and I simply cannot get this to work! When I try to send an email from the web client to gmail I get a warning from gmail that my server's IP address and domain are not allowed to relay since they are unauthenticated. According to my postfix configuration I should be authenticating using my own gmail credentials. But, the web client seems to ignore this.
When I try logging in directly on the Zimbra box I can use sendmail with the -tf parameters to mock up an email from one of my addresses to gmail and it works just fine. It is sent and looks like it came from the proper relay domain.
Is sender dependent relaying broken on 8.7? Does it work for anyone?
Welp, I gave up and set my server up to use gmail as the external relay for all accounts, and in my admin console I set my user account to be able to send from all of my external email addresses (specifying each of them there).
Now it properly relays through gmail and still shows each message as coming 'from' the external account I select in the new message window.
Maybe this will help someone with a similar issue.

Jenkins throws "Client does not have permissions to send as this sender"

There is lots of posts with users having same error, but none of them works for me...
I am trying to send email reports in Hudson/Jenkins...
Our mail server uses SSL/TLS, I configured Jenkins for TLS, then I am getting this error:
Client does not have permissions to send as this sender
When I try javamail using code, it sends the email properly. Also, Thunderbird works fine.
Any ideas? Do I need to contact mail server administrators?
Finally got it, thanks to Friso
Had to set my email address in System Admin e-mail address under Jenkins Location.
The email should be changed in three places as below as per version 2.19.4:
Extended E-mail Notification - If using SMTP plugin
Email Notification - SMTP Authentication
Jenkins location - System Admin e-mail address
I had the same issue, and I discovered that credentials were no more valid, so I asked to the IT department who told me that credentials were no more need on LAN.
Now it works!

Dotproject

I Have install dot project on linux machine. using ssmtp for gmail account to sending emails for mails notifications . but when i create any user it doesn't send mails to user email ID for account creation. but i send maail form shell prompt.the error i am getting is Failed to send email: 530 5.7.0 Must issue a STARTTLS command first. 22sm11794837wfd.6 added :( . Please help me if any one have solution....
Gmail requires a secure connection (TLS or SSL).
You need to configure SSMPT (not dotProject) to talk securely with Google's SMTP server.
I think you can just add the following to your ssmtp.conf file and (assuming your SSMTP package was compiled with SSL support) it should then work:
UseTLS=YES
Or perhaps:
UseSTARTTLS=YES
More info here.
I assume "530 5.7.0 Must issue a STARTTLS command first." means that you have to connect with TLS (Transport Layer Security). Does dot project support that?