我如何发送一封邮件给两个人,让他们都在收件人字段中看到对方?
以下是我的代码,它可以向两个人发送电子邮件,但是两个电子邮件收件人都看不到对方。 我正在使用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
Routes.rb (File in Config)
get 'sendemail' => 'users#send_email'
new.html.erb (File in app/views/users)
<%= link_to "Send email to both emails", sendemail_path %>
users_controller.rb(位于app/controllers文件夹)
def send_email
UserMailer.email(@user).deliver
redirect_to users_path
end