newbienewbie Posted February 27, 2007 Share Posted February 27, 2007 <html> <head> <title>Form Reader</title> </head> <body> <?php $to = 'a@yahoo.com'; $subjectmail() = 'the subject'; $message = 'hello'; $headers = 'From: a@yahoo.com' . "\r\n" . 'Reply-To: a@yahoo.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> </body> </html> Tell this newbie , why above program doesn't sends mail? Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted February 27, 2007 Share Posted February 27, 2007 <?php $to = 'a@yahoo.com'; $subjectmail() = 'the subject'; $message = 'hello'; $headers = 'From: a@yahoo.com' . "\r\n" . 'Reply-To: a@yahoo.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> try removing the HTML monk.e.boy Quote Link to comment Share on other sites More sharing options...
newbienewbie Posted February 27, 2007 Author Share Posted February 27, 2007 nothing happened . Any other suggestions Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted February 27, 2007 Share Posted February 27, 2007 <?php $to = 'a@yahoo.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: a@yahoo.com' . "\r\n" . 'Reply-To: a@yahoo.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> maybe that? monk.e.boy Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
newbienewbie Posted February 28, 2007 Author Share Posted February 28, 2007 plz. help newbie to learn php Quote Link to comment 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 Quote Link to comment 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- a@companyname.com. How i checked whether port 25 is open or not. I am able to use outlook for send mails. what shld i chk further. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
newbienewbie Posted March 6, 2007 Author Share Posted March 6, 2007 bump... any one can help me? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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('xyz@yahoo.com', '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. Quote Link to comment 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 = me@example.com Quote Link to comment 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 xyz@yahoo.com 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 = me@example.com sendmail_from = webmaster@example.com tried with smtp.myrealdomain.com also Quote Link to comment 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 ??? Quote Link to comment 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. Quote Link to comment 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: psike_89@hotmail.com' . "\r\n" . 'Reply-To: psike_89@hotmail.com' . "\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 = a@a.pt plz help me Quote Link to comment 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. Quote Link to comment 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? 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.