Whenever I send an email through my Rails app, in my inbox, the name of the sender is shown as "admin".. The email is admin@... The first part of the domain is shown. Im using Mandrill to send the email. How can I change this name?
每当我通过我的Rails应用程序发送电子邮件时,在我的收件箱中,发件人的名称显示为“admin”..电子邮件是admin @ ...显示域的第一部分。我使用Mandrill发送电子邮件。我该如何更改此名称?
2 个解决方案
#1
32
If you're using ActionMailer, try below
如果您正在使用ActionMailer,请尝试以下操作
mail(
from: 'Sender Name <sender@example.com>',
to: 'Receiver Name <receiver@example.com>',
subject: 'Subject'
)
If you're using the Mandrill API, you can explicitly set the sender name API call payload
如果您使用的是Mandrill API,则可以显式设置发件人名称API调用有效负载
#2
4
This work for me(Rails):
这项工作对我来说(Rails):
default(
from: "SenderName <hola@udocz.com>",
reply_to: "SenderName <hola@udocz.com>"
)
def send_mail(email, subject)
#body = ......
mail(to: email, subject: subject, body: body, content_type: "text/html")
end
#1
32
If you're using ActionMailer, try below
如果您正在使用ActionMailer,请尝试以下操作
mail(
from: 'Sender Name <sender@example.com>',
to: 'Receiver Name <receiver@example.com>',
subject: 'Subject'
)
If you're using the Mandrill API, you can explicitly set the sender name API call payload
如果您使用的是Mandrill API,则可以显式设置发件人名称API调用有效负载
#2
4
This work for me(Rails):
这项工作对我来说(Rails):
default(
from: "SenderName <hola@udocz.com>",
reply_to: "SenderName <hola@udocz.com>"
)
def send_mail(email, subject)
#body = ......
mail(to: email, subject: subject, body: body, content_type: "text/html")
end