Can't relay mail server to SendGrid - sendgrid

I've gone through the SendGrid integration instructions for Exim (http://docs.sendgrid.com/documentation/get-started/integrate/examples/exim/)
However, any email I send now is not being sent. Its all stuck in the queue. I looked for the log file for a message I'm trying to send and this is what I get:
2011-10-12 19:49:14 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1RE9U2-0007Qg-20
+++ 1RE9U2-0007Qg-20 has not completed +++
2011-10-12 19:49:14 1RE9U2-0007Qg-20 <= email#example.com H=localhost [127.0.0.1] P=esmtpa A=dovecot_login:email#example.com S=731 id=20111012194913.13697j8jpb4heop5#example.com T="Test"
2011-10-12 19:49:14 1RE9U2-0007Qg-20 == email#gmail.com R=send_via_sendgrid T=sendgrid_smtp defer (-53): retry time not reached for any host
I've had the support rebuild the exim db, but that hasn't helped. I'm thinking it has to do with the fact that its using the dovecot login instead of the sendgrid login which is added after it. How do I make it use the sendgrid login info? Thanks!!

If you aren't using your SG credentials you're going to run into authentification issues.
Try the following to make sure you are using the correct credentials:
*:sendgridusername:sendgridpassword

Related

Mail Reader Sampler - Unable to read mail from yopmail/mailinator using jmeter

Mail Reader Sampler - Unable to read mail from yopmail/mailinator using jmeter
I am sending mail to abc123#yopmail.com , i want to read that mail or check whether received the mail in abc123#yopmail.com or not.
I haven't got any POP3/IMAP details of yopmail/mailinator.
Any other way i can verify the received emails.
Response in Jmeter - Error code -500
Imap cred for yopmail:
mail-imap.yopmail.com
port - not mentioned
username - abc#yopmail.com
password - not mentioned

KeyCloak fails to send email using SMTP with status 500

I have Keycloak running in a Kubernetes cluster. Authentication works but I need to set up e-mail to be able to send e-mails for verification and password reset.
I have SendGrid set up as an SMTP Relay. These settings (host, port and api key) work when I send mail using the SendGrid java client. However, when pressing Test connection in KeyCloak I get:
[Error] Failed to load resource: the server responded with a status of 500 ()
[Debug] Remove message (services.js, line 14)
[Debug] Added message (services.js, line 15)
[Error] Can't find variable: error
https://<domain>/auth/resources/ong8v/admin/keycloak/js/controllers/realm.js:76 – "Possibly unhandled rejection: {}"
[Debug] Remove message (services.js, line 14)
There isn't much to go on here. I have an e-mail address set up for the currently logged in user. I've also tried resetting the password in case the Test connection functionality was broken but that didn't work either.
The Realm Settings settings user for email are as such:
host: smtp.sendgrid.net
port: 587
from: test#<domain>
Enable StartTLS: true
Username: "apikey"
Password: <api key>
Any idea what can be wrong? Or how to find out? For instance, maybe I can get a more meaningful error message somehow.
Edit:
I got the server logs.
Failed to send email: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.sendgrid.net, 587; timeout 10000;
nested exception is: java.net.SocketTimeoutException: connect timed out
Edit 2:
I've tried sending mail using Telnet using the exact same settings and that works. So apparently it's something with Keycloak or its underlying Java libraries that's causing issues sending e-mail.
Turns out that Keycloak works and that emails were blocked by the hosting provider.

Getting "Client was not authenticated to send anonymous mail during MAIL FROM" error from Exchange SMTP using Rust lettre library

I am writing a Rust application that will send email through an Exchange server with SMTP functionality enabled. According to Microsoft's webpage, the settings that are required are:
Server address smtp.office365.com
Port 587
StartTLS Enabled
Credentials for mail account login
These are corroborated by the POP/IMAP settings of the webmail service.
Here is my code (with some censoring):
extern crate lettre;
use self::lettre::email::EmailBuilder;
use self::lettre::transport::smtp::{SecurityLevel, SmtpTransportBuilder, SUBMISSION_PORT};
use self::lettre::transport::smtp::authentication::Mechanism;
use self::lettre::transport::EmailTransport;
pub fn send_mail() {
let email = EmailBuilder::new()
.from("my email")
.to("destination email")
.body("testing")
.subject("testing")
.build()
.unwrap();
// Connect to SMTP server
let mut transport = SmtpTransportBuilder::new(("smtp.office365.com", SUBMISSION_PORT))
.expect("Failed to create email transport")
.encrypt()
.smtp_utf8(true)
.credentials("my email", "my password")
.authentication_mechanism(Mechanism::Login)
.build();
println!("Mail transport built");
println!("{:?}", transport.send(email.clone()));
}
When I compile and run the code,it gives me this error:
Err(Permanent(Response { code: Code { severity:
PermanentNegativeCompletion, category: Unspecified3, detail: 0 },
message: ["5.7.57 SMTP; Client was not authenticated to send anonymous
mail during MAIL FROM [SYXPR01CA0106.ausprd01.prod.outlook.com]"] }))
Why is this happening?
The closest I've come in my research is an issue on GitHub in relation to the lettre library not supporting the Login authentication mechanism (which Office 365 uses); however, the codebase was updated to support Login and I am using the master branch directly from GitHub so theoretically my application should support the Login mechanism.
Edit: Forgot to mention that I attempted an EHLO to the server, but it returned a (Client:(Connection closed)) error.
I used telnet and openssl to try connecting directly to my SMTP server, where I found that AUTH LOGIN requires 3 commands; one to send the AUTH LOGIN code, one to send the username and another to send the password. I found that the lettre library implements all its AUTH commands as single commands, so this wasn't working with the server. I downloaded the source code for the library, changed the send function to do the three separate commands, recompiled my code and everything worked fine :)
My addition to the lettre code:
if (accepted_mechanisms[0] == Mechanism::Login) &&
(accepted_mechanisms.capacity() == 1) {
try_smtp!(self.client.command("AUTH LOGIN"), self);
try_smtp!(self.client.command(base64::encode_config(
&username.as_bytes(),
base64::STANDARD).as_str()), self);
try_smtp!(self.client.command(base64::encode_config(
&password.as_bytes(),
base64::STANDARD).as_str()), self);

Postfix transport: deliver different domains via different relayhosts

Postfix version 2.11.0
What I'm trying to accomplish is to have mail destined for a particular domain to be relayed through SendGrid but all other outgoing mail to be sent from my local server directly. I have this configuration in /etc/postfix/transport:
example.com smtp:[smtp.sendgrid.net]:587
.example.com smtp:[smtp.sendgrid.net]:587
* :
My understanding from all the searches I've done and reading the Postfix docs is that this should work but if I send to any other domain, for example gmail.com it's still getting relayed through SendGrid.
An example from /var/log/mail.log:
Oct 26 16:15:46 myhost postfix/smtp[25783]: A75F0C04F9: to=<PRIVACY_MASKED#gmail.com>, relay=smtp.sendgrid.net[108.168.190.108]:587, delay=11, delays=11/0.02/0.22/0.03, dsn=2.0.0, status=sent (250 Ok: queued as iTwf5zmCQQSgz_I6sVpSSA)
Is there some other configuration I'm missing?
Ok, now I see the error of my ways. In sasl_passwd I had this:
smtp.sendgrid.net USERNAME:PASSWD
But in transport I had this:
example.com smtp:[smtp.sendgrid.com]:587
The difference is .net versus .com.
Changed it to .net and works!

Mercury: sending email from localhost

I configured my Mercury (on local PC with Windows 7 professional) step-by-step following http://www.open-emr.org/wiki/index.php/Mercury_Mail_Configuration_in_Windows, using smtp.gmail.com as external server. I then sent a test email to my gmail from Mercury, and the Mercury core process window showed "Mon 01, 10:50:08: Job MG000001: from postmaster#localhost (local) .... to xxxx#gmail.com (non-local)-OK". But the Mercury SMTP client (relay version) window showed "Faild. Error FF servicing queue job." I saw this error message being repeated (Mercury tried to re-send the email).
I tried to gether more error information but the Mercury logs (XAMPP Control penal) was empty.
Can someone please help? Thanks.
I had the same problem as yours and I came out with this solution.
Follow the answer in this link:
No mail received in inbox with XAMPP 1.8.0, MercuryMail and mail()
And then go to
Mercury under MercuryS -> Connection Control -> Uncheck "Do not Permit SMTP relaying to non-local mail"
Hope it helps :)