user3093068
user3093068

Reputation: 1

Send a mail with php

I have a problem with my php:I want to send a simple mail in php..I using XAMPP My configure is: php.ini: only sendmail and mail.add_x_header is not commented

; For Win32 only.
; http://php.net/smtp
;SMTP = smtp.gmail.com
; http://php.net/smtp-port
;smtp_port = 587
sendmail_path = "C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header = Off

sendmail.ini:

smtp_server=smtp.gmail.com
;smtp port (normally 25)
smtp_port=587
smtp_ssl=true
[email protected]
auth_password=mypassword

and index.php

<?php
$subject="Hi There!!";
$to="[email protected]";
$body="This is my demo email sent using PHP on XAMPP";
if (mail($to,$subject,$body))
 echo "Mail sent successfully!";
   else
   echo "Mail not sent!";
  ?>

It runs without errors but the mail does not come...Where is my error ?pliz help me

Upvotes: 0

Views: 374

Answers (1)

MattWithoos
MattWithoos

Reputation: 351

You've got an extra quotation mark in your sendmail_path setting. Try changing your php.ini file from:

sendmail_path = "C:\xampp\sendmail\sendmail.exe\" -t"

to

sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"

Also are you doing this on a personal ISP or at work? Your ports might be blocked. Additionally Yahoo could be filtering your email as well. Could try adding headers.

Upvotes: 1

Related Questions