简体   繁体   中英

Ruby on Rails ActionMailer SMTP Settings

trying to set up my own ActionMailer::Base in RubyRails -> This works:

    ActionMailer::Base.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :domain               => "anythingworks",
    :user_name            => "mygmailaddress@gmail.com",
    :password             => "somePW",
    :authentication       => "plain",
    :enable_starttls_auto => true
    }

fine.. but it would be nice if I could use my mail server. but when i am trying this:

    ActionMailer::Base.smtp_settings = {
    :address              => "smtp.myowndomain.de",
    :port                 => 25, (tried 587) also
    :domain               => "triedanything",
    :user_name            => "mycorrectuser",
    :password             => "yesitisthecorretpw",
    :authentication       => "plain",
    :enable_starttls_auto => true
    }

Tried lot of different settings / changes. But no E-Mail is sent. Is there any logs avaiable to this ? Think its something because authentication... "login" instead of "plain" doesnt help...

Had some tests with telnet sending some E-mails from command line. gmail doesnt work from command line (saying STARTTTLS or something). My own domain mails server (which is hosted from some provider) says "relay access denied" (from commandline).

Webmail both working..

Any ideads ? Thanks!

The answer is the "relay access denied" message. Your smtp server needs to be configured to relay emails for this to work. I suspect that your smtp server is configured to accept connections for delivery TO your domain, not to relay emails elsewhere.

The same error message will probably be found in the smtp server's log files. Try sending an email to yourself (which would just be an accept, rather than a relay, for your smtp server). If emails to yourself are delivered, but emails to other domains are not, you will have confirmation that that is the problem.

Your ISP probably has an smtp server you can use for outgoing emails. If you want to use your own email server, it will need to be configured to relay emails.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM