flemingmike Posted June 22, 2010 Share Posted June 22, 2010 hello all, does anyone know of any simple tutorial, or simple script that i can learn to submit my html form to a php mailer? the stuff im finding in google isnt formatted so it can be easily read. thanks! Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 i found a tool called PHP Form Wizard i tried it out, it created me a php script, but when i tested, it said successfully sent, but nothing recieved in email. Quote Link to comment Share on other sites More sharing options...
radar Posted June 22, 2010 Share Posted June 22, 2010 read up on the mail function built into PHP. thats what i use... just send your action of the form to a php file, and mail from there... its great! Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 thanks radar. do you have a link? ive been trying to find this info, but i keep finding crap unlegible scripts. Quote Link to comment Share on other sites More sharing options...
sfc Posted June 22, 2010 Share Posted June 22, 2010 If you go on the php.net site and look up the function mail...you should find what you are looking for. Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 lol... cant believe i never checked php.net. one of those days! Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 ok, so im starting with this, and im getting error on line 9. <?php $to = 'email@rogers.com'; $subject = 'Email From Website'; $message = 'hello'; $headers = 'From: mike@email.ca' . "\r\n" . 'Reply-To: mike@email.ca' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> any ideas? Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 specific error is Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for *****@rogers.com in E:\Website\dance\registration.php on line 9 Quote Link to comment Share on other sites More sharing options...
radar Posted June 22, 2010 Share Posted June 22, 2010 ive never tried setting headers in a single variable, try doing it in multiple like: $headers = 'From: mike@email.ca\r\n' $headers .= 'Reply-To: mike@email.ca\r\n' $headers .= 'X-Mailer: PHP/' . phpversion().'\r\n'; and see if that works... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 22, 2010 Share Posted June 22, 2010 The message is coming from your SMTP server. Something may be misconfigured there. Which SMTP server are you using? Ken Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 my iis server has exchange running on it. Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 i tried what you said radar, i get this error: Parse error: syntax error, unexpected T_VARIABLE in E:\Website\dance\registration.php on line 6 Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 here is my current code: <?php $to = '****@rogers.com'; $subject = 'Email From Website'; $message = 'hello'; $headers = 'From: mike@****.ca\r\n' $headers .= 'Reply-To: mike@****.ca\r\n' $headers .= 'X-Mailer: PHP/' . phpversion().'\r\n'; mail($to, $subject, $message, $headers); ?> Quote Link to comment Share on other sites More sharing options...
flemingmike Posted June 22, 2010 Author Share Posted June 22, 2010 radar, i saw your other postings on the add cc to email, so im trying that. here is my alternate code: <?php $email = $_POST['Email1']; $name = $_POST['FirstName1'] $_POST['LastName1']; $mailto = 'mike@*****.ca'; $mailsubj = "Email From Website"; $mailhead .= "FROM: ".$name; $mailhead .= "Reply-To: ".$email; $mailhead .= "CC: ".$email; $mailbody = "Values submitted from LOI:\n"; while (list($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; } mail($mailto, $mailsubj, $mailbody, $mailhead); ?> im getting this error: Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in E:\Website\dance\registration.php on line 18 any ideas? Quote Link to comment Share on other sites More sharing options...
radar Posted July 12, 2010 Share Posted July 12, 2010 Often times, the mail function has issues in a localhost setting. I've had the same thing happen to me but the moment I upload it to live server, it works perfectly. mail functions are hard to figure out sometimes... but my suggestion is to try it on your live server, and not on the local host server and see what that says to you. 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.