Hi! I have a problem with sending of e-mail from my website. I got a script that sends e-mail upon order. E-mail is delivered and everything, but somehow the recipient is twice in the TO: field. The funny thing is, that the e-mail is only delivered once. In the TO: field, first the e-mail is listed and the second time (after comma) name and surname added through the field are »covering« the e-mail in Outlook. While in gmail it says me both times. Basically the recipient is added twice but e-mail is delivered only once (as it should). Any idea what could be wrong? I am really new to php. Thank you all in advance! BR
It would help a great deal if you could post the code here. There should be some sort of message prior post to request code for such questions, that is if there isn't one already.
function sendEmail($fromEmail,$fromEmailName,$toEmail,$toEmailName,$subject,$message,$extra='') { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: '.$toEmailName.' <'.$toEmail.'>' . "\r\n"; $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>' . "\r\n"; //$headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; //$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; // Mail it /*echo "From : $fromEmail - $fromEmailName <br>"; echo "To : $toEmail - $toEmailName <br>"; echo "Subject : $subject <br>"; echo "Message : $message <br>"; echo "$headers <br>"; exit;*/ wp_mail($toEmail, $subject, $message, $headers); } PHP: That is the function that sends e-mail.