问题描述
如何发送仅将cc和bcc选为选项的邮件
data[:cc] = cc if cc.present?
data[:bcc] = cc if bcc.present?
mail to: to,subject: subject,data
解决方法
简短答案:
def welcome(recipient)
@account = recipient
mail(to: recipient.email_address_with_name,bcc: ["[email protected]","Order Watcher <[email protected]>"])
end
您不需要任何:cc
标签。 to
中的所有接受者(当前接受者除外)将被视为CC:
to: ["[email protected]","[email protected]"]
在您的特定情况下:
to = ["[email protected]","[email protected]"]
bcc = ["[email protected]","[email protected]"]
mail to: to,bcc: bcc,subject: subject,data
阅读文档here