Page 1 of 1

[SOLVED]problem sending mails from the defined server

Posted: Mon Dec 04, 2006 6:47 am
by ryuuka
mail prob this time

i keep getting the following error
Warning: mail() [function.mail]: SMTP server response: 501 RCPT TO Syntax Error In Address <To: ryuuka@mysite.nl> in D:\wwwroot\Website\upload.php on line 101

and the following is the code that generates the error

Code: Select all

mail("To: $download_mail", "The following mail from $Naam is waiting to download",
	"http://www.mysite.net/Website/download.php?file_id=$description",
	"From: $upload_mail"
	);
can anybody tell me what the problem is?

Posted: Mon Dec 04, 2006 7:06 am
by volka
Why's there a To: in the first parameter?

Posted: Mon Dec 04, 2006 7:15 am
by ryuuka
that was the question:

the php function said that should be there i removed it and now it works excelent

thanks for the pointer

Posted: Mon Dec 04, 2006 7:19 am
by volka
Where does the php function say there should be a To: within the first parameter string?

Posted: Mon Dec 04, 2006 7:22 am
by ryuuka
Example 4. Sending HTML email

It is also possible to send HTML email with mail().

Code: Select all

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
   <tr>
     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
   </tr>
   

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; <===============
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

Posted: Mon Dec 04, 2006 7:27 am
by volka
No. There's no To: in the first parameter. $header is the fourth parameter.

Posted: Mon Dec 04, 2006 7:41 am
by ryuuka
k my mistake


will remmember this in the future