ra_ie_darkness Posted November 4, 2011 Share Posted November 4, 2011 Hello, I am trying to create a registration module where an email would be sent to the user after registration. I am using xampp and have tried php mailer http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php4/0.90/ but couldn't get it to work... I've been told that it is possible to send an email from localhost through smtp... I need to know how to accomplish that. Am a beginner. suggestions and help would be appreciated Link to comment https://forums.phpfreaks.com/topic/250439-i-need-to-send-mail-through-localhost/ Share on other sites More sharing options...
seany123 Posted November 4, 2011 Share Posted November 4, 2011 Localhost cannot just send emails, it has to run through a mail server. for testing purposes you could try "ArGoSoft Mail Server" Link to comment https://forums.phpfreaks.com/topic/250439-i-need-to-send-mail-through-localhost/#findComment-1284948 Share on other sites More sharing options...
ra_ie_darkness Posted November 6, 2011 Author Share Posted November 6, 2011 Thank you for the reply. Here is the detail of what i've tried so far I am trying to use google's smtp server these are the changes that i have made in php.ini [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 465 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = postmaster@localhost ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" Below is a part of send mail.ini smtp_server=smtp.gmail.com ; smtp port (normally 25) smtp_port=465 ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify smtp_ssl=auto default_domain=google.com ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging ;error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging ;debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines [email protected] auth_password=mygmailpassword Finally this is the php file that i am trying to run <?php $to='[email protected]'; $subject='mysub'; $message='messagebody.'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to,$subject,$message,$headers); echo 'see'; ?> when i use the port 586 I only get "see" (from the last line of my php file) but the recipients have not received any mail but when i use port 465 the page keeps on loading forever and nothing happens. I need to know what i'm doing wrong and how to fix it Link to comment https://forums.phpfreaks.com/topic/250439-i-need-to-send-mail-through-localhost/#findComment-1285494 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 Are you putting in your google u/n and password anywhere? Those will be required. Link to comment https://forums.phpfreaks.com/topic/250439-i-need-to-send-mail-through-localhost/#findComment-1285496 Share on other sites More sharing options...
ra_ie_darkness Posted November 6, 2011 Author Share Posted November 6, 2011 yes I have posted those in sendmail.ini and have displayed that in this post (not the real password) Link to comment https://forums.phpfreaks.com/topic/250439-i-need-to-send-mail-through-localhost/#findComment-1285497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.