atar.yosef Posted December 3, 2012 Share Posted December 3, 2012 (edited) Hi there!! I have copied and changed the following code snippet from the php.net site: <?php$to = 'myusername@mydomain.com';$subject = 'the subject';$message = 'hello';$headers = 'From: webmaster@example.com\r\n';if(mail($to, $subject, $message, $headers)){ echo "Success!!"; }?> unfortunately, my script wasn't executed and I didn't receive the email even in my junk folder. Can someone help me solve this trouble? Thanks in advance!! atar. Edited December 3, 2012 by atar Link to comment Share on other sites More sharing options...
thescientist Posted December 3, 2012 Share Posted December 3, 2012 just because it is on php.net, doesn't mean it is ready to go, copy and paste code. Do you have an SMTP server installed on your host? 1 Link to comment Share on other sites More sharing options...
atar.yosef Posted December 3, 2012 Author Share Posted December 3, 2012 @thescientist:Thanks for replying!!When I look in the output of the phpinfo() method, I see that there's a row which in its first column it reads "SMTP" and in its second column it reads "localhost". Is that okay? How can I achieve more info if there's in my host a SMTP server?Thanks in advance!!Atar. Link to comment Share on other sites More sharing options...
satishpoul Posted December 7, 2012 Share Posted December 7, 2012 heyy ur code is perfect.. but in case if u want to send mail from localhost server. then u must need to do some settings of your SMTP server in php.ini file. but if u are going to upload your code Live on your site. this will really gonna work..still if u want to run mail() function from localhost i think u must refer this 1) http://www.phpgeniou...your-localhost/ 2) http://rajeshstutori...-localhost.html i haven't tried since simple mail function will work on live site so u try.. hope this will help u 1 Link to comment Share on other sites More sharing options...
atar.yosef Posted December 7, 2012 Author Share Posted December 7, 2012 @satishpoul:Thanks you very much about your kind and detailed response!! I'm really appreciate that!!I'll try ASAP to review the reference you've referred me to and will try if this will work for me.Sincerely!!Atar. Link to comment Share on other sites More sharing options...
atar.yosef Posted December 7, 2012 Author Share Posted December 7, 2012 @satishpoul:Unfortunately, the solutions suggested at the sites you've referred me to aren't related to me since I use at Linux based server and those solutions are about windows based servers.However, thanks for your attempt to help me!Sincerely!Atar. Link to comment Share on other sites More sharing options...
birbal Posted December 7, 2012 Share Posted December 7, 2012 are you using localhost or 3rd party web server? if it is localhost you will need to install sendmail like mail server and set the setting in php.ini "SMTP" to point to sendmail executable binary file path. If it is 3rd party server it is probably already installed, in that case contacting your server admin would be the best option. 2 Link to comment Share on other sites More sharing options...
westman Posted December 7, 2012 Share Posted December 7, 2012 just in case you have not done so, please put <?php on line 1 have no line brakes Link to comment Share on other sites More sharing options...
atar.yosef Posted December 8, 2012 Author Share Posted December 8, 2012 Thanks to all the members which making effort to help me with this problem!!@birbal:I use at 3rd server. Probably they want some fee in order to allow me using their SMTP server.@westman:I tried your advice. Unfortunately, this didn't solve the problem.Thanks to all!Atar. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now