SendGrid configuration

45 views
Skip to first unread message

Noel Welsh

unread,
Apr 22, 2013, 12:55:15 PM4/22/13
to purpose-pl...@googlegroups.com
Hi everyone,

I'm having a hard time getting SendGrid to accept emails. My configuration (mail.rb) is this:

ActionMailer::Base.smtp_settings = {  
  :address        => "smtp.sendgrid.net",
  :domain         => "fightforthefuture.org",
  :port           => 587,
  :user_name      => ENV["SENDGRID_USERNAME"],
  :password       => ENV["SENDGRID_PASSWORD"],
  :authentication => :plain,
  :enable_starttls_auto => true
#  :openssl_verify_mode => 'none'
}

I'm running in development mode on my dev machine (so not fightforthefuture.org). I have the environment variables set. I'm consistently getting this error from the delayed job:

550 Cannot receive from specified address <an email address>: Unauthenticated senders not allowed

an email address (actually a valid email address, but I don't want spammers to find it here) is the email address I've said to send emails from (it's the same as is registered for SendGrid). Tracing the SMTP interaction (by disabling SSL) shows that Rails is not authenticating with SendGrid. SendGrid then closes the connection with the above error message.

I've found various tips of the Internet regarding this: pasting username and password directly into the, disabling SSL, etc. Nothing works -- authentication just isn't happening.

Any ideas?

Thanks,
Noel

john

unread,
Apr 22, 2013, 5:43:15 PM4/22/13
to purpose-pl...@googlegroups.com
Hi Noel,

Are you running into this problem when trying to send 'autofire' emails or blasts?

The settings in mail.rb are only used for sending 'administrative' platform emails. These are the emails used to manage platform users (admins); for example changing passwords.

Blast and autofire emails use the same sendgrid account (and IP address), and there is flexibility to specify a different sendgrid account to use for sending target decisionmaker emails (to prevent damaging the reputation of the blast and autofire ip address).

The blast/autofire account can be specified with the following environment variables:

MOVEMENT-SLUG_BLAST_EMAIL_DOMAIN
MOVEMENT-SLUG_BLAST_EMAIL_PASSWORD
MOVEMENT-SLUG_BLAST_EMAIL_USERNAME

Let me know if that helps. There is more info here:


MailConfigulator sets the mail configs for each type, its methods are called in SendgridMailer.


Thanks,
John

Noel Welsh

unread,
Apr 23, 2013, 5:07:29 AM4/23/13
to purpose-pl...@googlegroups.com
I was having problems with blasts. Setting the environment variables you described and also setting WHITELISTED_EMAIL_TEST_DOMAINS were what I needed to get emails working. 

I've added a note to the wiki about the format of the MOVEMENT-SLUG.

Thanks,
N.

john

unread,
Apr 23, 2013, 11:27:03 AM4/23/13
to purpose-pl...@googlegroups.com
Glad that worked, I updated the docs to note that ENABLE_UNFILTERED_BLASTING is false if unset and that you then need to set WHITELISTED_EMAIL_TEST_DOMAINS,

Reply all
Reply to author
Forward
0 new messages