开发者

In rails, How to send emails with action mailer using mdaemon mail server?

I have installed mdaemon mail server in my computer, and register the email user "administrator@tuzhu001.com". I have also tested it with "worldclient" that it can send emails correctly. Now I want to send emails with action m开发者_开发技巧ailer using this mail server. But I cannot send email correctly. The sending email method is shown below:

def register_email(user)

    ActionMailer::Base.smtp_settings = {
        :address  => "127.0.0.1",
        :port => 25, 
        :domain  => "tuzhu001.com",
        :authentication  => :login,
        :user_name  => "administrator@tuzhu001.com",
        :password => "123456",
    }    
    recipients    user["email"]
    from          "administrator@tuzhu001.com"
    subject       "Welcome to Tuzhu"
    body          (:url => user["url"])
    sent_on       Time.now
end

Anyone can help me?


most likely a problem with your MTA (= Mail Transfer Agent)

  • try to disable password authentication for testing purposes
  • check if your MTA wants just the username (without domain) for authentication

in the call to ActionMailer::Base.smtp_settings() or .sendmail_settings()

you should set the content_type

content_type 'text/html' or content_type 'text/plain'

the body should be either a string containing the correct content type

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜