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
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\_code\.code\}'>click
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/#\{company.downcase.strip.squeeze("
").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
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:
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: