title: How do I send to multiple recipients in Rails?
body: <p>I am learning how to use Ruby on Rails and I am having difficulties sending an email to multiple users. I created a simple rails app. The code I have actually sends the emails, but both emails are not copied in the same email. In other words User1 does not see User2 email or vice versa. My question is </p>
  
  <p><strong>"How do I get User1 and User2 to see each other when they get the email?"</strong></p>
  
  <p>Here is the code in my user_mailer.rb file:</p>
  
  <pre><code>def email1(user1, user2)
      @user1 = User.find_by(email: "myyahooemail@yahoo.com")
      @user2 = User.find_by(email: "mygmailemail@gmail.com")
      mail(to: "#{@user1.email}, #{@user2.email}",
          subject: 'Testing sending emails to 2 people',
          body: 'The email should have both users in the TO field')
  end
  </code></pre>
  
  <p>Here is the code in my users_controller.rb file:</p>
  
  <pre><code>def send_email1
     UserMailer.email1(@user1, @user2).deliver
     redirect_to users_path
  end
  </code></pre>
  
  <p>Here is the code in my routes.rb file:</p>
  
  <pre><code>get 'sendemail1' =&gt; 'users#send_email1'
  </code></pre>