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
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

auth_username=mygmailid@gmail.com
auth_password=mygmailpassword

 

Finally this is the php file that i am trying to run

<?php


$to='reciever@gmail.com';	
$subject='mysub';
$message='messagebody.';

$headers = 'From: mygmailid@gmail.com' . "\r\n" .
    'Reply-To: mygmailid@gmail.com' . "\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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.