Two same recipients in the TO: field problem

Discussion in 'PHP' started by Matt18, Jul 14, 2011.

  1. #1
    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
     
    Matt18, Jul 14, 2011 IP
  2. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #2
    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.
     
    BRUm, Jul 14, 2011 IP
  3. Matt18

    Matt18 Guest

    Messages:
    591
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    Matt18, Jul 16, 2011 IP