siabanie Posted March 23, 2011 Share Posted March 23, 2011 Hi guys I need some help here about mailer. I have created a file register new user (register.php) and when a new user register an email will be sent to their address. I have this code on my register file but when I run them it's okay but I did not get the email... can anyone assist me what I did wrong? Thanks. <?php $to = "someone@example.com"; //change to a valid email $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; //change to a valid email $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 Testing on a webserver @ a hosting company or your local machine ? Second of all, add the following to the top: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 Thanks MrHellboy, Im testing on my local machine... What is this actually doing? ini_set('display_errors', 1); error_reporting(E_ALL); And do I need to configure anything? Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 It shows errors for all sort of kinds. Could you please run your script once more and copy and paste the notices, warning or whatever you get @ the top of your page ? Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 I see - well the mailer code that I have shown did not have any error - when I register a new user and click submit it will redirect to the thank you page. There is no error showing. But I did not get the email...that is what bugging me. I have placed the code you suggested but there is not warning or what-so-ever, the script went through fine...but I am not getting an email... Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 Since you are testing on your localhost.... You need a mail server for that. F.i Argo mailserver (freeware) Then alter the following directives @ php.ini http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 I have done the setting in php.ini by amended these but I am not sure what I did was right... mail.add_x_header "0" mail.log NULL SMTP "localhost" smtp_port "25" sendmail_from myemailaddress@hotmail.com sendmail_path (disable) I dont know what to put here. Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 This is impossible: sendmail_from with your @hotmail.com account. You have to install argo mailserver, and create a account from there. Create something like test@locahost and fill the @ sendmail_from Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 I have installed the ArGoSoft Mail Server. And create a new user. I don't really know how it works but I fill in all the information e.g but not sure what I did is correct? Forward Address: test@localhost Return Address: another@localhost Do I have to changed in php.ini or where? Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 Do you have outlook or another MUA (email client) ? Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 I have Microsoft outlook but I didnt use them. I am using Window live mail. Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 Doesn't matter which MUA. Just open outlook and create a new account on email adress test@localhost(must be created @ argosoft mail server). SMTP & POP3 server = localhost php.ini SMTP = localhost sendmail_from = test@localhost (or another). Dont forget to restart apache Quote Link to comment Share on other sites More sharing options...
siabanie Posted March 23, 2011 Author Share Posted March 23, 2011 Hi MrXHellboy, I am not sure if I got your instruction correctly.. But I have created a new user on the argosoft mail server providing all the info e.g User Name:test Real Name:test Password:test123 Forward Address:test@localhost Return Address:test@localhost And on the outlook I just created: Incoming mail server:localhost Outgoing mail server:localhost But it is still not working...I think I did not get it correct. Any idea? Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 You can explain on MSN... You already added me.... 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.