Jump to content


Photo

Sending Mail


  • Please log in to reply
10 replies to this topic

#1 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 10 July 2006 - 07:48 PM

Hi

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

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

My "From" header is:

$headers .= "From: $ml_from_name <$ml_from_email>" . "\r\n";

Can anyone help me out?




If you're not part of the solution, you're part of the precipitate

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 10 July 2006 - 08:06 PM

Can you post the rest of the code that creates the mail?

Ken

#3 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 10 July 2006 - 09:07 PM

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?
If you're not part of the solution, you're part of the precipitate

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 10 July 2006 - 09:41 PM

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

#5 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 10 July 2006 - 09:49 PM

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:
$headers .= "From: \"$ml_from_name\" <$ml_from_email>" . "\r\n";

<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#6 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 11 July 2006 - 07:24 PM

Sorry Shogun, didnt work

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

// 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>";
		}

If you're not part of the solution, you're part of the precipitate

#7 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 13 July 2006 - 09:17 PM

Bump
If you're not part of the solution, you're part of the precipitate

#8 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 17 July 2006 - 10:23 AM

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 http://nz.php.net/ma...nction.mail.php mail function page at php.net

Could it be something to do with the way my PHP is set up?
If you're not part of the solution, you're part of the precipitate

#9 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 17 July 2006 - 10:29 AM

I think the problem is the SMTP mail server.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#10 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 17 July 2006 - 11:02 AM

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?
If you're not part of the solution, you're part of the precipitate

#11 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 17 July 2006 - 01:16 PM

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.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users