mikemedia Posted February 13, 2007 Share Posted February 13, 2007 I want to send PHP form data via an email server NOT the web server. I have written a function and saved it as a php.ini within my website’s root directory which is the same as is the location of the PHP file. Here is exactly what is written as php.ini. Only the names have been changed. 1 [mail] 2 SMTP = theCompany.email.server.com 3 SMTP_PORT = 25 4 SENDMAIL_FROM = [email protected] Here is exactly what is written as contactMe.php. Only the names have been changed. 1 <?php 2 include("/siteRoot/php.ini"); 3 $sendTo = " [email protected] "; 4 $subject = "Subject: $_POST[senderSubject] \r\n"; 5 $headers = "From: $_POST[senderName] \r\n"; 6 $headers = "Reply-To: $_POST[senderEmail] \r\n"; 7 $message = "Name: ".$_POST["senderName"] . "\r\n" ."Email: ".$_POST["senderEmail"] ."\n" ."Comments: ".$_POST["senderComments"] ; 8 mail($headers, $sendTo, $subject, $message); 9 ?> I have removed any references to “MIME” I have tried using ini_set() included within lines 3 and 4 of contactMe.php. For example: //$mail_ini=ini_set('SMTP', " theCompany.email.server.com "); //$mail_ini=ini_set('smtp_port',25); Still, the “connection” is being sought on the web server instead of the email server. I suspect I my syntax of line 8 mail() is somehow wrong. [mail] SMTP = theCompany.email.server.com SENDMAIL_FROM = [email protected] Warning: mail() [function.mail]: Failed to connect to mailserver at "exchange.thestupidWebserver.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in \webmaster.php on line 8 Specific help (showing script) is appreciated Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/ Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 I have written a function and saved it as a php.ini within my website’s root directory which is the same as is the location of the PHP file. Sorry, can you explain that again? Also... is this web server Linux or windows? Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/#findComment-183599 Share on other sites More sharing options...
ToonMariner Posted February 13, 2007 Share Posted February 13, 2007 http://uk2.php.net/manual/en/ref.imap.php Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/#findComment-183602 Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 Sorry ToonMariner, did you actually read the post? Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/#findComment-183603 Share on other sites More sharing options...
mikemedia Posted February 14, 2007 Author Share Posted February 14, 2007 I am not allowed to use the web hosting server to deliver email. I want to direct the email to the server that provides SMTP. What I have written doesn't work. Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/#findComment-184539 Share on other sites More sharing options...
mikemedia Posted February 14, 2007 Author Share Posted February 14, 2007 Let me try this again... Web server: Windows 2003 Email server: Windows 2000 I am getting an error that says that my function failed to connect to the 'mailserver' on the the 'web server'. That's because there is no mailserver on my web server. The error message goes on to suggest that I verify my SMTP and SMTP Port setting in php.ini or use ini_set() embeded within my *.php file I have verified that SMTP and Port are correct. I am unsure if my syntax is correct. I have been reading a lot of instructions re: PHP and SMTP. I have even cut and pasted scripts modifying only those things that apply to me, e.g. SMTP = theCompany.email.server.com SMTP_PORT = 25 SENDMAIL_FROM = [email protected] What, if anything, is wrong with my script? (please see original post) Thank you for your time. Link to comment https://forums.phpfreaks.com/topic/38310-connect-to-email-server-from-the-web-server/#findComment-184558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.