Diogo Carvalho
Diogo Carvalho

Reputation: 13

PHPMailer - multiple emails in same Page

My PHPMailer is working perfectly but my problem is that when i receive the different emails from different person´s , all the emails will be received inside the same message (because PHPMailer send emails always from 1 single email (management@gmail.com)). Its possible to receive always emails in different messages?? Because like that its confused to manage the email.

IMAGEM_EMAIL

email2

  $mail = new PHPMailer(true);
  $mail->IsSMTP();        
  $mail->Host = 'smtp.gmail.com';  
  $mail->Port = 587;       
  $mail->SMTPAuth = true;      
  $mail->Username = 'management@gmail.com';
  $mail->Password = '*********';    
  $mail->SMTPSecure = 'tls';      
  $mail->From = $_POST["email"];      
  $mail->FromName = $_POST["name"];    
  $mail->addAddress('website@gmail.com');
  $mail->AddCC($_POST["email"], $_POST["name"]); 
  $mail->WordWrap = 50;      
  $mail->IsHTML(true);         
  $mail->Subject = $_POST["subject"];    

Upvotes: 0

Views: 72

Answers (1)

Errorname
Errorname

Reputation: 2471

There is two issues here:

1/ Your gmail/inbox is grouping the mails you receive from PHPMailer. And for that, there is no solution. It's what gmail/inbox do and you can't do anything about that.

2/ You want to hit "reply" to these mails and reply not to "management@gmail.com" but to your user's mail. You can add a "Reply-To" field in mails to achieve that:

$mail->addReplyTo($_POST["email"], $_POST["name"]);

Upvotes: 1

Related Questions