ActionMailer SMTP_SETTING에 지정된 사용자 이름에서 이메일 만 보낼 수 있습니까?
-
05-07-2019 - |
문제
내 ActionMailer Config 파일에는 다음과 같습니다.
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.foo.com",
:port => 25,
:domain => "foo.com",
:authentication => :email,
:user_name => "no-reply@foo.com",
:password => "foo1234567"
}
이 구성을 사용하면 이메일 만 보낼 수 있습니다. no-reply@foo.com
이메일 주소? 그렇다면 다른 주소에서 이메일을 보내는 방법이 있습니까? 내 액션 메일러 클래스에 이것을 가지고 있습니다.
class Notifications < ActionMailer::Base
def answered_question(faq)
subject 'Your question has been answered'
recipients faq.email
from 'Foo <no-reply@foo.com>'
sent_on Time.now
content_type "text/html"
body :faq => faq
end
def completed_order(order)
subject 'Your order has been completed'
recipients order.email
from 'Foo <registrations@foo.com>'
sent_on Time.now
content_type "text/html"
body :order => order
end
end
개발에서 모든 것이 잘 작동하지만 생산에서 completed_order
이메일이 전송되지 않습니다.
감사.
해결책
나는 이것이 ActionMailer라는 SMTP 문제에 더 가깝다고 생각합니다. 일부 SMTP는 나가는 메일을 보내려면 사용자 이름/암호가 필요하지 않으므로 원하는대로 주소를 설정할 수 있습니다.
즉, SMTP 서버에 인증하는 데 사용하는 것과 다른 주소를 가진 메시지를 보내는 문제가 발생하기 때문에 SMTP 상자에 메시지를 보낼 수있는 제한이있을 것 같습니다. From 주소는 인증 UID와 일치합니다.
제휴하지 않습니다 StackOverflow