Forum: Ruby on Rails how to avoid (Net::SMTPFatalError) "555 5.5.2 Syntax error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
11bbca99cea0c2f3de8cd6de4d20e2d9?d=identicon&s=25 Santosh Turamari (santuhvr)
on 2009-04-23 08:30
Hi all,
  I have written code to send mails through action_mailer, where in I
called
                 MassNotifier.deliver_forward_review_link(current_user.profile.display_name,email,params[:notification][:message],params[:title],params[:designation],params[:company],params[:id],@invitation.invitation_code)

this method , and in mass_notifier.rb
I fave written

def
forward_review_link(sender,recipients,message,title,designation,company,id,code)

  return if UnsubscribedEmail.find_by_email(recipients)
    @unsubscribe_code = MailingList.find_or_create_by_email(recipients)
    if @unsubscribe_code.code.nil?
       @unsubscribe_code.code = Digest::SHA1.hexdigest(
Time.now.to_s.split(//).sort_by {rand}.join )
       @unsubscribe_code.save
    end
    @body[:unsubscribe_link] = "<a
href='http://www.somelink.com/unsubscribe/#{@unsubscribe...
here to unsubscribe<\/a>"

    MassNotifier.delivery_method = :activerecord
    @recipients  = "#{recipients}"
    @from = "#{sender}<aaa@bbb.com>"
    @subject = "Check out the Review on #{company}"
    @body[:review_link] = "<a
href='http://www.somelink.com/company-review-rating/#{co...
").gsub(/[^[:alnum:]]/,'-').squeeze("-").chomp("-")}/#{designation.strip.squeeze("
").gsub(/[^[:alnum:]]/,'-').squeeze("-").chomp("-")}/#{id}'>clck
here<\/a>"
    @body[:company_name] = "#{company}"
    @body[:sender_name] = "#{sender}"
    content_type "text/html"
end

If I submit an email id, It is giving error as
(Net::SMTPFatalError) "555 5.5.2 Syntax error. d29sm1994943and.38\n"
How to avoid this error

Please help me its urgent.
75ceef25624b3e44943a3b7319ba9612?d=identicon&s=25 Chris Schumann (torgo)
on 2009-07-31 14:26
Santosh Turamari wrote:
>     @from = "#{sender}<aaa@bbb.com>"

> If I submit an email id, It is giving error as
> (Net::SMTPFatalError) "555 5.5.2 Syntax error. d29sm1994943and.38\n"

The from line is the problem. The Net::SMTP library was recently changed
so it adds angle brackets to your sender, so you cannot have any in your
string. Try this as a workaround:

    @from = "aaa@bbb.com"
88e8edffe72efdfadf6b50bb17d50957?d=identicon&s=25 Francesco Canessa (makevoid)
on 2009-08-24 15:03
(Received via mailing list)
Hi Chris,

the workaround solved the problem, thank you!

Is there another way to display a name with the email address without
using angle brackets ?

Thanks!

On Jul 31, 2:26 pm, Chris Schumann <rails-mailing-l...@andreas-s.net>
75ceef25624b3e44943a3b7319ba9612?d=identicon&s=25 Chris Schumann (torgo)
on 2009-08-24 17:05
Francesco Canessa wrote:
> Hi Chris,
>
> the workaround solved the problem, thank you!
>
> Is there another way to display a name with the email address without
> using angle brackets ?
>
> Thanks!
>
> On Jul 31, 2:26�pm, Chris Schumann <rails-mailing-l...@andreas-s.net>

Display? Sure. Do anything you want.

But as of Rails 2.3.3, the from email address will get the angle
brackets added, so it can only contain the address.

Rails 2.3.4 is/was supposed to fix that, and includes tests so it will
be ensured in future versions.
993700440a909714d55b99b91f0ad8de?d=identicon&s=25 Shan Huang (Guest)
on 2009-08-29 00:35
(Received via mailing list)
Thank you so much, I had the same problem and it worked.

On Jul 31, 2:26 pm, Chris Schumann <rails-mailing-l...@andreas-s.net>
4b57319c67f743ca71321465b73d4104?d=identicon&s=25 Aslam Syed (zufar)
on 2009-09-01 14:25
Hello all,

I am trying to send email and written code like this:

<code>
 def matches_for_request( contact, req, matching_offers )
    recipients  "#{contact}"
    from        "gaadishare@mapunity.in"
    subject     "Matches found for your request"
    sent_on     Time.now

    body[:offers] = matching_offers
  end
</code>

I also had put angled brackets in the from address like
"<gaadishare@mapunity.in>". However, as Chris's reply suggets I tried
removing the angled brackets. But, this did not solve my problem. I am
continuing to get the following error message:

555 5.5.2 Syntax error. 23sm387874pxi.9

Please help.
F8a1fb3c7b0006971fe986a49a164464?d=identicon&s=25 Bruno Brunagh (brunagh)
on 2009-09-18 12:50
Aslam Syed wrote:
> Hello all,
>
> I am trying to send email and written code like this:
>
> <code>
>  def matches_for_request( contact, req, matching_offers )
>     recipients  "#{contact}"
>     from        "gaadishare@mapunity.in"
>     subject     "Matches found for your request"
>     sent_on     Time.now
>
>     body[:offers] = matching_offers
>   end
> </code>
>
> I also had put angled brackets in the from address like
> "<gaadishare@mapunity.in>". However, as Chris's reply suggets I tried
> removing the angled brackets. But, this did not solve my problem. I am
> continuing to get the following error message:
>
> 555 5.5.2 Syntax error. 23sm387874pxi.9
>
> Please help.


Hi all,
I have the same issue:
Net::SMTPFatalError 555 using rails 2.3.3
under development environment

I both tried with or without angle brackets in the @from parameter,
 but with no help.

Any idea?

Thanks
1b7e51db758175b388544aee05d7aba6?d=identicon&s=25 Karim Helal (khelal)
on 2009-12-15 10:58
Any updates on how we can send a @from with a name before the email
address?

I want to be able to send emails using the noreply@monaqasat.com email
address but show 'Monaqasat' as the name of the sender.

Thx.

.Karim

Bruno Brunagh wrote:
> Aslam Syed wrote:
>> Hello all,
>>
>> I am trying to send email and written code like this:
>>
>> <code>
>>  def matches_for_request( contact, req, matching_offers )
>>     recipients  "#{contact}"
>>     from        "gaadishare@mapunity.in"
>>     subject     "Matches found for your request"
>>     sent_on     Time.now
>>
>>     body[:offers] = matching_offers
>>   end
>> </code>
>>
>> I also had put angled brackets in the from address like
>> "<gaadishare@mapunity.in>". However, as Chris's reply suggets I tried
>> removing the angled brackets. But, this did not solve my problem. I am
>> continuing to get the following error message:
>>
>> 555 5.5.2 Syntax error. 23sm387874pxi.9
>>
>> Please help.
>
>
> Hi all,
> I have the same issue:
> Net::SMTPFatalError 555 using rails 2.3.3
> under development environment
>
> I both tried with or without angle brackets in the @from parameter,
>  but with no help.
>
> Any idea?
>
> Thanks
Bc572b4652b1df3ea13619423acd6127?d=identicon&s=25 Nimesh Nikum (nimeshnikum)
on 2010-06-17 11:15
Try to do like this:
from     "Monaqasat <noreply@monaqasat.com>"
headers  "return-path" => 'noreply@monaqasat.com'

It worked for me !!!

Thanks,
Nimesh Nikum

Karim Helal wrote:
> Any updates on how we can send a @from with a name before the email
> address?
>
> I want to be able to send emails using the noreply@monaqasat.com email
> address but show 'Monaqasat' as the name of the sender.
>
> Thx.
>
> .Karim
>
> Bruno Brunagh wrote:
>> Aslam Syed wrote:
>>> Hello all,
>>>
>>> I am trying to send email and written code like this:
>>>
>>> <code>
>>>  def matches_for_request( contact, req, matching_offers )
>>>     recipients  "#{contact}"
>>>     from        "gaadishare@mapunity.in"
>>>     subject     "Matches found for your request"
>>>     sent_on     Time.now
>>>
>>>     body[:offers] = matching_offers
>>>   end
>>> </code>
>>>
>>> I also had put angled brackets in the from address like
>>> "<gaadishare@mapunity.in>". However, as Chris's reply suggets I tried
>>> removing the angled brackets. But, this did not solve my problem. I am
>>> continuing to get the following error message:
>>>
>>> 555 5.5.2 Syntax error. 23sm387874pxi.9
>>>
>>> Please help.
>>
>>
>> Hi all,
>> I have the same issue:
>> Net::SMTPFatalError 555 using rails 2.3.3
>> under development environment
>>
>> I both tried with or without angle brackets in the @from parameter,
>>  but with no help.
>>
>> Any idea?
>>
>> Thanks
E1957b5e4fc7128511d167e79dd499da?d=identicon&s=25 kannav rajeev (Guest)
on 2010-06-17 16:22
(Received via mailing list)
use action mailer optional tls

http://douglasfshearer.com/blog/gmail-smtp-with-ru...

On Thu, Jun 17, 2010 at 2:45 PM, Nimesh Nikum <lists@ruby-forum.com>
wrote:

> > Any updates on how we can send a @from with a name before the email
> >> Aslam Syed wrote:
> >>>
> >>>
> >>
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> 
rubyonrails-talk+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


--
Thanks:
Rajeev sharma
This topic is locked and can not be replied to.