Jump to content

Archived

This topic is now archived and is closed to further replies.

sanfly

Sending Mail

Recommended Posts

Hi

Im trying to get an HTML sendmail script to work, but I am getting the follwing error:

[code]Warning: mail() [function.mail]: SMTP server response: 501 <Intergalactic Records<******@*******.com>>: "@" or "." expected after "Intergalactic" in C:\server\www\adv_admin\admin\maillist.php on line 858[/code]

My "From" header is:

[code]$headers .= "From: $ml_from_name <$ml_from_email>" . "\r\n";[/code]

Can anyone help me out?



Share this post


Link to post
Share on other sites
Can you post the rest of the code that creates the mail?

Ken

Share this post


Link to post
Share on other sites
Will have to be later, Im at work now and the code is on my home PC

I would have thought the code I posted was enough find the error though?

Share this post


Link to post
Share on other sites
No, you posted one PHP line out of context. you didn't even post the mail() function call. How can we debug your problems without more data?

Ken

Share this post


Link to post
Share on other sites
Making a stab at it I'm going to say that maybe you need quotes around the name like so:
"David Doran" <daviddoranmedia@gmail.com>

so it might be:
[code]
$headers .= "From: \"$ml_from_name\" <$ml_from_email>" . "\r\n";
[/code]

Share this post


Link to post
Share on other sites
Sorry Shogun, didnt work

Ken, is this enough?  It's to send HTML email

[code]// send emails to mailing list
$total = 0;
$f = 0;
if(in_array("maillist", $mle_recip)){
echo "<b>MAILING LIST</b><br>";
include "db.php";
$r = mysql_query("SELECT * FROM ml_recipients WHERE mlr_active = '1'") or die(mysql_error());
$num = mysql_num_rows($r);
$total = $total + $num;
$x = 1;
$i = 0;
while($row = mysql_fetch_array($r)){
$mlr_email = $row['mlr_email'];
$recipient = stripslashes($row['mlr_name']);

$message = $message_pre1;  // The header of the message
$message .= $recipient;        // The recipients name
$message .= $message_pre2; // The part of the message between the recip name and the main message
$message .= nl2br($mle_message);  // The main message
$message .= $message_post;  // The message footer

$hold = 50; // quantity of emails sent before 3 sec delay

  // email Headers
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $ml_from_name <$ml_from_email>" . "\r\n";
// Mail it
if(mail($mlr_email, $mle_subject, $message, $headers)){
echo "SENT: $mlr_email<br>";
$i++;
  $x++;
    if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    sleep(3);
    $x = 0;
    }
}
else{
$f++;
echo "FAILED: $mlr_email<br>";
}
}
echo "<br><br>";
}[/code]

Share this post


Link to post
Share on other sites
I have the same problem when I copy the html email example exactly from the example (with my own domain substituted for example.com) on the [url=http://]http://nz.php.net/manual/en/function.mail.php[/url] mail function page at php.net

Could it be something to do with the way my PHP is set up?

Share this post


Link to post
Share on other sites
Its definitely a setting on my computer.  I just uploaded to the website server and everything works fine.

Can anyone help me figure out what the error in my settings might be?

Share this post


Link to post
Share on other sites
If you're working on Windows, and you're website server is Linux then the problem is probably that the mail is not being sent properly by your SMTP Local Server(if one is set up), but that the Linux Sendmail is working fine.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.