Page 1 of 1
Using PHP Mail function on a Windows server
Posted: Wed Mar 21, 2007 3:52 pm
by indepthmedia
Code: Select all
<?php
$to = 'me@wherever.com';
$subject = 'New Order Placed';
$message = 'hello';
$headers = 'From: sales@wherever.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
I read something on PHP.net that Windows servers (my server) require you to pass SMTP information when using a mail function - is this true? If so, what is the syntax for that?
Or is there something else wrong with my code above? (The mail does not get sent)
Thank You.
Posted: Wed Mar 21, 2007 4:15 pm
by ambivalent
What's in your php.ini?
Code: Select all
[mail function]
; For Win32 only.
SMTP = 192.168.1.3
smtp_port = 25
; For Win32 only.
sendmail_from = mailbot@domain.com
Posted: Wed Mar 21, 2007 4:33 pm
by RobertGonzalez
What mail program are you using to send mail?
Posted: Wed Mar 21, 2007 5:07 pm
by Chris Corbyn
That message is probably being tagged as spam. Messages which practically say nothing more than "hello" get tagged. The word "Hello" in a subject line is particularly subject to being tagged as spam.
EDIT | Comment removed, I got mixed up with another post