aantix
August 28, 2006, 8:00am
1
I get this when trying to send out an email. What exactly does this
error mean?
Net::SMTPSyntaxError (501 <>: missing or malformed local part
):
/usr/lib/ruby/1.8/net/smtp.rb:680:in check_response' /usr/lib/ruby/1.8/net/smtp.rb:653:in
getok’
/usr/lib/ruby/1.8/net/smtp.rb:635:in rcptto' /usr/lib/ruby/1.8/net/smtp.rb:546:in
send0’
/usr/lib/ruby/1.8/net/smtp.rb:545:in send0' /usr/lib/ruby/1.8/net/smtp.rb:472:in
sendmail’
/usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.5/lib/action_mailer/base.rb:513:in
perform_delivery_smtp' /usr/lib/ruby/1.8/net/smtp.rb:379:in
start’
/usr/lib/ruby/1.8/net/smtp.rb:316:in start' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.5/lib/action_mailer/base.rb:511:in
perform_delivery_smtp’
/usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.5/lib/action_mailer/base.rb:397:in
deliver!' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.5/lib/action_mailer/base.rb:291:in
method_missing’
/app/controllers/workout_controller.rb:58:in `notifyNewWorkout’
aantix
August 28, 2006, 2:08pm
2
I think that you are entering some mail addres (to or from) in the wrong
format.
They usually are something like:
“This is my name” [email protected]
Jim J.
escribió:
aantix
August 28, 2006, 6:09pm
3
How can I catch this so that when my function fails, I can just move on
to the next user? My email function looks like this:
class NewWorkoutNotify < ActionMailer::Base
def notify_new_workout(user)
# Email header info MUST be added here
@recipients = user.email
@from = "[email protected] "
@subject = "New Workout Ready"
# Email body substitutions go here
@body["login"] = user.login
end
end
Matias S. wrote:
I think that you are entering some mail addres (to or from) in the wrong
format.
They usually are something like:
“This is my name” [email protected]
Jim J.
escribióº?¦gt;
aantix
September 12, 2008, 7:09pm
4
I had this error when I screwed up the ‘recipients XXXXXX’ line in my
mailer model.
I had ‘recipients = XXXXXX’ instead of ‘recipients XXXXXX’
I found this by adding some logger.info statements in:
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb
…in the deliver! method. I then saw that there were no recipients
being given to net::smtp
Good luck!
Something that may also help debugging, you can hack
/usr/lib/ruby/1.8/net/smtp.rb and add a few print statements inside
get_response, recv_response, and getok, in order to see what is actually
coming to and from the SMTP server.
This helped me immensely. Be warned however, as this will cause ugly
text to be printed on every app on your server that uses these
libraries.
aantix
October 23, 2009, 3:23am
5
I have seen this error as well, and found the problem to be the email
address having a leading ‘space’.
For example, I was passing an email address like this: " Bob S.
[email protected] " and was getting the error.
As soon as I stripped the space away with ‘.strip’ before I assigned it
to ‘recipients’, the error went away.
Not sure which part of the code (gem or ruby) was choking on the
whitespace. I didn’t investigate further. I am using Action::Mailer
2.2.2.
aantix
March 28, 2007, 10:22pm
6
Jim… Did you figure out what was causing this problem for you? I’ve
got a production app that has been sending out emails just fine for
months, but all of a sudden it’s spitting these out and throwing
application errors.
Any ideas?
Thanks.
–mark
On Aug 28 2006, 1:00 am, Jim J. [email protected]