Fearpig Posted October 20, 2006 Share Posted October 20, 2006 Hi Guys,I'm still having real problems sending a basic text e-mail through PHP. Could someone take a look at my code and settings and hopefully point me in the right direction? :)PHP.ini[code][mail function]; For Win32 only.SMTP = FER-MAIL.ferroli.local; for Win32 onlysmtp_port = 25sendmail_from= [email protected] ; for Win32 only[/code]HTML Form[code]<form name="LiteratureRequestForm" method="post" action="Process_Request_Form2.php"><fieldset> <legend class='Body3'>CONTACT DETAILS</legend> <table width="400" border="0" cellspacing="0" cellpadding="4" class="Body2"> <tr> <td width="157" align="right"><div align="right">*Name:</div></td> <td width="4"> </td> <td width="215"><input name="Name" type="text" id="Name"></td></tr></table></fieldset> <table width="400" border="0" cellspacing="0" cellpadding="4" class="Body2"> <tr> <td colspan="2" align="right" class="BodyText1"> <div align="right"> <input type="reset" name="Submit2" value="Clear Form"> </div></td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table></form>[/code]...and here's the processing page[code]<?php/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */$email = '[email protected]';$subject = 'literature request';$message = $HTTP_POST_VARS['Name'];/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) { echo "<h4>Invalid email address</h4>"; echo "<a href='javascript:history.back(1);'>Back</a>";} elseif ($subject == "") { echo "<h4>No subject</h4>"; echo "<a href='javascript:history.back(1);'>Back</a>";}/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */elseif (mail($email,$subject,$message)) { echo "<h4>Thank you for sending email</h4>";} else { echo "<h4>Can't send email to $email</h4>";}?>[/code]This is the error message that I get popping up:Warning: mail() [function.mail]: Failed to connect to mailserver at "FER-MAIL.ferroli.local" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\Intranet v3\e-mail_test\Process_Request_Form2.php on line 25Can't send email to [email protected]Any help would be REALLY appreciated as I've been stuck ??? on this for days now!! CheersTom Link to comment https://forums.phpfreaks.com/topic/24531-mail-not-working/ Share on other sites More sharing options...
Daniel0 Posted October 20, 2006 Share Posted October 20, 2006 Make sure that FER-MAIL.ferroli.local is the address to your smtp server. Link to comment https://forums.phpfreaks.com/topic/24531-mail-not-working/#findComment-111760 Share on other sites More sharing options...
Fearpig Posted October 20, 2006 Author Share Posted October 20, 2006 Hi Daniel0,FER-MAIL is the name of my MS Exchange server, how do I confirm that this is the correct address for SMTP mail? Link to comment https://forums.phpfreaks.com/topic/24531-mail-not-working/#findComment-111782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.