Muralidharan
Muralidharan

Reputation: 1

custom from address in rails mailer

In my rails application I am trying to send mail using custom from address.

It works fine few times, but most of the time it doesn't work. I am getting the following smtp error message

Net::SMTPFatalError (553 Sorry, your envelope sender is in my badmailfrom list.
):
    C:/Ruby/lib/ruby/1.8/net/smtp.rb:687:in `check_response'
    C:/Ruby/lib/ruby/1.8/net/smtp.rb:660:in `getok'
    C:/Ruby/lib/ruby/1.8/net/smtp.rb:638:in `mailfrom'
    C:/Ruby/lib/ruby/1.8/net/smtp.rb:550:in `send0'
    C:/Ruby/lib/ruby/1.8/net/smtp.rb:475:in `sendmail'
    /vendor/rails/actionmailer/lib/action_mailer/base.rb:638:in `perform_delivery_smtp'

Here is my sample code

In mailer.rb

  def mail_to_friend(recipient_mail, sender_mail, subjects, messages, host, port)
    @host = host
    @port = port

    recipients recipient_mail
    from       "#{sender_mail}"  #custom from address
    subject    "#{subjects}"
    sent_on    Time.now    
    body       :message_body => messages, :host => host, :port => port
    content_type "text/html"
  end

I am using Rails 2.3.5 and Ruby 1.8.6. PS: I am not using google smtp server(using own smtp server)

Thanks in Advance

Upvotes: 0

Views: 338

Answers (1)

tripleee
tripleee

Reputation: 189936

The owner of the remote SMTP server banned you (or the guy you are impersonating), I guess because you were using their server to test weird stuff without asking for permission (or because what you are doing approximates what spammers do, and you triggered an automatic ban rule).

Upvotes: 1

Related Questions