mail function not sending email?

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
nihilist
Forum Newbie
Posts: 5
Joined: Mon Jul 14, 2003 4:55 am

mail function not sending email?

Post by nihilist »

Hello, Im having trouble getting my script/server to send email.

I used the function on the php.net website, and it is returning that mail is sent, however I have not received a single email in testing this script on any of the emails I have tested with. What is going on?

Code: Select all

<?
function send_mail($myname, $myemail, $contactname, $contactemail, $subject, $message) {
 $headers .= "MIME-Version: 1.0\n";
 $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
 $headers .= "X-Priority: 1\n";
 $headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: php\n";
 $headers .= "From: "".$myname."" <".$myemail.">\n";
return(mail(""".$contactname."" <".$contactemail.">", $subject, $message, $headers));
}
if (send_mail("username", "useremail@isp.com", "Customername", "Customer@customer.com", "This is a test")) {
print "SENT!";
} else {
 print "FAILED!";
}
?>
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

...

Post by kettle_drum »

Is SMTP up and running on the box your using and is php configured to use it?
nihilist
Forum Newbie
Posts: 5
Joined: Mon Jul 14, 2003 4:55 am

Post by nihilist »

Yes it is set up and is set up as localhost in php.

I am not housing it on my server, it is being hosted on a commercial server, so I am assuming they set it up properly.
Post Reply