Jump to content

I need to send mail through localhost


ra_ie_darkness

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.