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 = "[email protected]"; //change to a valid email $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; //change to a valid email $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/ 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); Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191198 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? Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191224 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 ? Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191230 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... Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191238 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 Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191242 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 [email protected] sendmail_path (disable) I dont know what to put here. Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191250 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 Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191253 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? Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191261 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) ? Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191263 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. Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191268 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 Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191272 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? Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191416 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.... Link to comment https://forums.phpfreaks.com/topic/231471-need-help-about-mailer-function/#findComment-1191418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.