mail() on a MS server...help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hurdy gurdy
Forum Commoner
Posts: 40
Joined: Mon Jun 09, 2003 8:19 pm

mail() on a MS server...help!

Post by hurdy gurdy »

Hi all!

First off... This is the first time I've tried using the mail() function on a Microsoft server... It's driving me nuts! For some reason the emails aren't being sent. I keep reading that "The Windows implementation of mail() differs in many ways from the Unix implementation." and "Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function." However the latter isn't explained enough for my simple mind.

I've checked to see if the internal sendmail support for windows was installed... it is. And the sendmail_from is set to localhost. I assume it's my code that's causing the problem. I've got to get this working ASAP, could some kind person show me the light?

here's the basics of my code:

Code: Select all

$to = $_REQUEST[email];
$headers .= "FROM: jill@mysite.com\r\n";
$headers .= "BCC: me@mysite.com\r\n";
$subject = "$_REQUEST[sname] has sent you a postcard!";
$message .= "Clever copy thing here...\n\n";
$message .= "Click on the link or copy and paste the following URL into your web browser to view your postcard.\n\n";
$message .= "http://www.mysite.com/postcard.php?p=$_REQUEST[uid]\n\n";
$message .= "Thank You!\n";
$message .= "Jill\n\n";
		
if ( !mail($to, $subject, $message, $headers) ) {
	$error = "Sorry.  There was a problem sending the postcard to the address provided.  Please try again.";
}
Any help would be appreciated!
Thanks
HG
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: mail() on a MS server...help!

Post by volka »

hurdy gurdy wrote:"Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function."
That's from
http://www.php.net/manual/en/ref.mail.php wrote:Here's a short explanation of the configuration directives.

SMTP string
Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function.

smtp_port int
Used under Windows only: Number of the port to connect to the server specified with the SMTP setting when sending mail with mail(); defaults to 25. Only available since PHP 4.3.0.
So, what values did you set for
php.ini wrote:[mail function]
; For Win32 only.
SMTP =
smtp_port =
?
hurdy gurdy
Forum Commoner
Posts: 40
Joined: Mon Jun 09, 2003 8:19 pm

Post by hurdy gurdy »

I didn't set the sucker up :) not taking the blame for that...

However.. looking at the phpini():

SMTP - 127.0.0.1
smtp_port - 25

It must be that IP address... right?
Post Reply