Reputation: 61
My user has email with this format: "[email protected]". Mailgun validation succeeded but Rails couldn't send email to the address. I'm using SMTP with Mandrill. This is the error message:
/home/johnny/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/smtp.rb:948:in `check_response': 401 4.1.3 Bad recipient address syntax (Net::SMTPServerBusy)
Do you have any idea?
Thanks in advance.
Updated:
This sample code (with valid SMTP configuration) would raise the error:
#!/usr/bin/env ruby
require 'mail'
options = {
address: "smtp.mandrillapp.com",
port: 587,
domain: "mydomain.com",
authentication: "login",
user_name: "[email protected]",
password: "mypassword",
enable_starttls_auto: false
}
Mail.defaults do
delivery_method :smtp, options
end
Mail.deliver do
from '[email protected]'
to "[email protected]"
subject 'Testing sendmail'
body 'Testing sendmail'
end
Upvotes: 4
Views: 5119
Reputation: 5611
Even if the starting dash in the email address is valid, most mail servers do not accept such emails due to restrictions for command line arguments.
A quick fix you can try is wrapping the email address with angle brackets:
Mail.deliver do
from '[email protected]'
to "<[email protected]>"
subject 'Testing sendmail'
body 'Testing sendmail'
end
Upvotes: 3