newbienewbie Posted February 27, 2007 Share Posted February 27, 2007 <html> <head> <title>Form Reader</title> </head> <body> <?php $to = '[email protected]'; $subjectmail() = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> </body> </html> Tell this newbie , why above program doesn't sends mail? Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/ Share on other sites More sharing options...
monk.e.boy Posted February 27, 2007 Share Posted February 27, 2007 <?php $to = '[email protected]'; $subjectmail() = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> try removing the HTML monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195146 Share on other sites More sharing options...
newbienewbie Posted February 27, 2007 Author Share Posted February 27, 2007 nothing happened . Any other suggestions Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195157 Share on other sites More sharing options...
monk.e.boy Posted February 27, 2007 Share Posted February 27, 2007 <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> maybe that? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195164 Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 no luck yet. tried that also. any other suggestions? Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195809 Share on other sites More sharing options...
Archadian Posted February 28, 2007 Share Posted February 28, 2007 make sure your ISP does NOT have port 25 blocked Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195811 Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 i am able to send mails using outlook. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195815 Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 plz. help newbie to learn php Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195864 Share on other sites More sharing options...
monk.e.boy Posted February 28, 2007 Share Posted February 28, 2007 Argh! As far as we can tell your code is ok, you need to look at where else the error may be. Have you tried the port 25 thing yet? If it is not open, then the mail WILL NOT be sent. My host does not open port 25, I'd guess so they don't get spammers abusing their system. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195908 Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 i think ports are open. i am using my company id ex- [email protected]. How i checked whether port 25 is open or not. I am able to use outlook for send mails. what shld i chk further. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195911 Share on other sites More sharing options...
monk.e.boy Posted February 28, 2007 Share Posted February 28, 2007 are you running outlook on the same server as your PHP code? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195916 Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 scneario is like this: i am working in a company, and checking my regular mails in outlook. and now i have copied this small prog and executing in my local box(http://127.0.0.1:8080/testing/mailform.php). if u require more infor let me know. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-195925 Share on other sites More sharing options...
monk.e.boy Posted February 28, 2007 Share Posted February 28, 2007 Don't know. It should work. ??? ??? ??? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-196032 Share on other sites More sharing options...
newbienewbie Posted March 1, 2007 Author Share Posted March 1, 2007 ok, lets see, when my contact form works . anyway thank you so much. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-196615 Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 bump... any one can help me? Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200562 Share on other sites More sharing options...
JasonLewis Posted March 6, 2007 Share Posted March 6, 2007 do you receive any errors or anything. try running it in an if statement just to be sure and if you get errors post them. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200570 Share on other sites More sharing options...
monk.e.boy Posted March 6, 2007 Share Posted March 6, 2007 Find and download an email script that you know works. Test it. If this new script fails, then you know your LAMP server is broken somewhere. If it works, then you know your code it broke. Try that and tell us how it went. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200611 Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 on my live server, just 2line code is working fine <?php mail('[email protected]', 'Test Subject', 'Test Message'); echo "Mail Sent"; ?> but it is not working on local server. what sshld i do troubleshoot local server. other php code on local server is wrking fine. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200665 Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 php.ini setting for mail is like this [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = [email protected] Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200681 Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 getting following errro in apache SMTP server response: 550 5.7.1 Unable to relay for [email protected] in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\testing\\mail.php on line 11 [mail function] ; For Win32 only. ;SMTP = localhost SMTP=localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = [email protected] sendmail_from = [email protected] tried with smtp.myrealdomain.com also Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200691 Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 finally this worked php.ini SMTP=mail.myrealdomain.com can anyone guide me why it worked for above instead of SMTP=<b>smtp</b>.myrealdomain.com ??? Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200702 Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 6, 2007 Share Posted March 6, 2007 Do you have a sub-directory called smtp in your mydomain domain? Perhaps 'mail' is a symbolic link that points to your 'smtp' folder which handles mail tasks. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200842 Share on other sites More sharing options...
reshpu Posted March 6, 2007 Share Posted March 6, 2007 i have the same problem.... this is my code: $to = $_POST['Email']; $subject = "Welcome"; $body = "<p>Bem Vindo</p> <p>Vimos por este mail informar que a sua activação da conta está completa.</p>"; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); ..... if (mail($to, $subject, $body, $headers)) { echo("<p>Email enviado!</p>"); in my php.ini i change to this way: [mail function] ; For Win32 only. SMTP = smtp.myrealdomain.com smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] plz help me Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-200848 Share on other sites More sharing options...
newbienewbie Posted March 7, 2007 Author Share Posted March 7, 2007 Do you have a sub-directory called smtp in your mydomain domain? Perhaps 'mail' is a symbolic link that points to your 'smtp' folder which handles mail tasks. no sub-directory. my domain is live and hosted somewhere else. any other thoughts welcome. Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-201441 Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 7, 2007 Share Posted March 7, 2007 That's my point...perhaps your host is using 'mail' instead of 'smtp'....I'm hosting with Canaca...and when I connect to their smtp server, I use mail.mydomain.com....maybe you have to do the same? Link to comment https://forums.phpfreaks.com/topic/40332-sending-mail/#findComment-201460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.