tbailey Posted March 21, 2006 Share Posted March 21, 2006 Hi,I'm trying to use the php mail() function. I'm using PHP 4.3.10 on Win2K3 server. My SMTP is correctly pointing to my smtp server (a different box), however I'm getting nada when trying to send mail.Please help :-)Thanks soo much in advance.t Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 21, 2006 Share Posted March 21, 2006 Please post the code you're using. We can't help you without it.Ken Quote Link to comment Share on other sites More sharing options...
tbailey Posted March 21, 2006 Author Share Posted March 21, 2006 Have tried calling it from several files. I'm confident that the coding is not the problem, but rather something I'm missing in my system config. Forgot to mention that the webserver is running IIS 6 also.Do I need to set up a SMTP (local) virtual server in IIS? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted March 21, 2006 Share Posted March 21, 2006 Mate throw us someting!Post any error messages, the code for generating the email, its contenst adn headers and such forth....We can't help until we can see what the problem is. Quote Link to comment Share on other sites More sharing options...
tbailey Posted March 21, 2006 Author Share Posted March 21, 2006 k.Here's a sample form:<form action="tbaileyprocess.php" method="post">Name: <input type="text" name="name" size="20" maxlength="20" /><br />Email: <input type="text" name="email" size="30" maxlength="30" /><br />Subject: <input type="text" name="subject" size="30" maxlength="30" /><br />Text:<textarea name="text" name="text" cols="50" rows="10"></textarea><br /><input type="submit" name="submit" value="Send" /></form>---------------------------------------the FILE: tbaileyprocess.php:---------------------------------------<?php@extract($_POST);$name = stripslashes($name);$email = stripslashes($email);$subject = stripslashes($subject);$text = stripslashes($text);mail('myemail@myemail.com',$subject,$text,"From: $name <$email>");header("location:tbaileyform.php");?>Like I said, I'm sure that this coding is fine. But am thinking that I'm missing something in my system. Nagging in the back of my mind is how does my smtp server authenticate this mail being sent? All I have pointing to the server is the SMTP setting in php.ini???Thanks! :-) Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 21, 2006 Share Posted March 21, 2006 The "From:" line should be terminated with a new-line character "\r\n"[code]<php<?php$name = stripslashes($_POST['name']);$email = stripslashes($_POST['email']);$subject = stripslashes($_POST['subject']);$text = stripslashes($_POST['text']);$to = 'myemail@myemail.com';$headers = "From: $name <$email>\r\n";mail($to,$subject,$text,$headers);header("location:tbaileyform.php");?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
tbailey Posted March 21, 2006 Author Share Posted March 21, 2006 Like I said.... I'm dubious placing the code on the site....I've tried several files (some of which have been tested on other systems and work perfectly). Please....the coding IS NOT the problem. The issue is somewhere in my flow / configuration. Is there something that should be specified in IIS that would effect this?On the SMTP server that the mail function sends to, is there some parameters that need to be set to accept the email that originates from mail() ? Quote Link to comment Share on other sites More sharing options...
tbailey Posted March 21, 2006 Author Share Posted March 21, 2006 Please, can anyone help with this?Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.