如何向2个收件人发送电子邮件,并且两个收件人在收件人中看到对方?

Mau*_*cio 3 ruby email ruby-on-rails actionmailer mandrill

如何向2个人发送电子邮件并让他们在电子邮件的收件人字段中看到对方?

下面是我的代码,它会向两个人发送电子邮件,但两个电子邮件收件人都没有看到对方.我正在使用Mandrill发送我的电子邮件(不知道这些信息是否有帮助).

User_mailer.rb(app/mailers中的文件)

class UserMailer < ApplicationMailer
default from: 'Mauricio@example.com'

def email(user)
   mail(to: "1@gmail.com, 2@gmail.com",
   subject: 'Send email to 2 email accounts', 
   body: 'Email to be sent to 2 email accounts. Both recipients should see each other.')
end
Run Code Online (Sandbox Code Playgroud)

Routes.rb(配置文件)

get 'sendemail' => 'users#send_email'
Run Code Online (Sandbox Code Playgroud)

new.html.erb(app/views/users中的文件)

<%= link_to "Send email to both emails", sendemail_path %>
Run Code Online (Sandbox Code Playgroud)

users_controller.rb(app/controllers中的文件)

def send_email
   UserMailer.email(@user).deliver
   redirect_to users_path
end
Run Code Online (Sandbox Code Playgroud)

Phi*_*rom 5

确保您正在发送X-MC-PreserveRecipients标题并将其设置为true.

If you send to more than one recipient at a time and want all recipients to
see each other recipient's information, use the X-MC-PreserveRecipients 
header. Recipients will be able to reply-all and see other recipient
information if this is set to true. If it's set to false, Mandrill will 
rewrite the To and Cc headers for your email and only show information 
about an individual recipient.
Run Code Online (Sandbox Code Playgroud)

https://mandrill.zendesk.com/hc/en-us/articles/205582117-Using-SMTP-Headers-to-customize-your-messages#preserve-recipient-headers-for-group-emails