0

I want to send email from my localhost server. I am using here wamp server and sendmail option. but i am getting no error :-

but no mail are sending to the users email

if (!$result)
{
    die (mysql_error());
}


if ($result == 1)
{
    $rows = mysql_fetch_array($sql);
    $password = $rows['pwd'];
    $email = $rows['user_email'];
    $subject ="Password request";
    $header = "FROM: sazalach@gmail.com";
    $body = "Your password is " . $password;

    mail ($email, $subject, $header, $body);
    print("an email containning the password has been sent to you");
}else
{
    echo ("No such user exists in the system. Please try again");
}

Here is below sendmail configuration:

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=465

; SMTPS (SSL) support
;   auto = use SSL for port 465, otherwise try to use TLS
;   ssl  = alway use SSL
;   tls  = always use TLS
;   none = never try to use SSL

smtp_ssl=auto

; 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

;default_domain=mydomain.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=sazalach@gmail.com
auth_password=

; if your smtp server uses pop3 before smtp authentication, modify the 
; following three lines.  do not enable unless it is required.

Below configuration is in php.ini file

; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 465

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you@yourdomain

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
Sazal Ahmed
  • 97
  • 1
  • 10
  • You're not able to send anything through querying with `mysql_` functions, as Wamp only runs on `mysqli_` or PDO. As per the latest version anyway. – Funk Forty Niner Jan 05 '15 at 19:33
  • Getting no error, that's because you're not checking for them or you don't have it set on your system. Add error reporting to the top of your file(s) right after your opening ` – Funk Forty Niner Jan 05 '15 at 19:34
  • @Fred-ii-...thank you for your comment..i have used it...but what is the problem to send the mail... – Sazal Ahmed Jan 05 '15 at 19:37
  • You're welcome. Add the code I gave you, it will signal errors, if any are found. – Funk Forty Niner Jan 05 '15 at 19:38
  • @Fred-ii-..no error showing but if send possible i set a message an email containning the password has been sent to you ...it is showing...but no email send – Sazal Ahmed Jan 05 '15 at 19:41
  • Try port 587 instead of 465. Also look at http://blog.techwheels.net/send-email-from-localhost-wamp-server-using-sendmail/ – Funk Forty Niner Jan 05 '15 at 19:43
  • @Fred-ii-..Thank you very much ...your shared link help me to complete this task...finally i have able to send email from my localhost – Sazal Ahmed Jan 05 '15 at 21:56
  • That's great Sazal, am glad this matter go resolved and was happy to have been of help, *cheers* and thanks for the update. – Funk Forty Niner Jan 05 '15 at 21:57

0 Answers0