Note that there are some explanatory texts on larger screens.

plurals
  1. POPHPMailer 5.1 sends duplicatie mails when adding more than 1 receiver
    primarykey
    data
    text
    <p>I'm using PHPMailer for a while now and never really had any problems, but last week I installed one of my CMS on a website and the client insisted on having 2 e-mails receiving the contents of the contact form of his website.</p> <p>Ok, no problem I thought, just adding an e-mail address using the $phpmailer->AddAddress() function. However, adding a second receiver is causing PHPMailer to send the mail twice to both receivers. I tried adding a third receiver to see if I got it three times, but this didn't change anything. So adding 2+ receivers is causing PHPMailer to send the message twice to all receivers.</p> <p>There's nothing strange in my code. It's a basic PHPMailer example:</p> <pre><code>$mail = new PHPMailer(); $mail-&gt;AddReplyTo("name@yourdomain.com","First Last"); $mail-&gt;SetFrom('name@yourdomain.com', 'First Last'); $mail-&gt;AddAddress("info@address.com"); $mail-&gt;AddAddress("info@address.nl"); $mail-&gt;Subject = "PHPMailer Test Subject via mail(), basic"; $mail-&gt;Send(); </code></pre> <p>I've ran out of options. I have absolutely no clue where it's going wrong.</p> <p>Thanks in advance</p> <p>--</p> <p>Just some random thought: I noticed the mailer is defaulted by iso-8859-1 and my site is running utf8. Can there be a "silent" redirect by the server itself?</p> <p>//EDIT, that ^^ solved my problem</p> <p>//EDIT2:</p> <p>Ok, it did not.. today the script worked fine (just 1 mail with 2 receivers) but a moment ago the strange behavior started again. Any tips?</p> <p>// Solution:</p> <p>ok, I feel quiet stupid! The answer Zulkhaery Basrul came closest to the actual problem! This is what happened: I was sending an e-mail to multiple addresses in the "to" field. For example:</p> <p>To: A, B, C</p> <p>Both A/B are my own adresses. In outlook I had some message rules to put e-mails with certain addressees inside a specific folder. Both A and B had this rule.</p> <p>When I recieved my e-mail, both mails contained both mailaddresses in the to-field. Causing both of the mails to meet the rule requirements for both rules. Thus keeping the original in one folder and creating a copy in the other (twice).</p> <p>Thanks for thinking tho :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload