email - Unable to send mail from gmail with xampp (using php script) -


i using xampp on windows 7 i'm unable send mail using php

the php.ini file part under:

smtp = smtp.gmail.com smtp_port = 25 sendmail_from = hima***ivast***@gmail.com sendmail_path = "c:\xampp\sendmail\sendmail.exe -t" mail.add_x_header = off 

the sendmail.ini file part under:

smtp_server=smtp.gmail.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log auth_username=hima***ivast***@gmail.com auth_password=************ force_sender=hima***ivast***@gmail.com 

please me find error.

if have ssl enabled on gmail account, port number 587. believe other 465, per docs: https://support.google.com/mail/answer/78775?hl=en

if tried configuring smtp server on port 465 (with ssl) , port 587 (with tls), still having trouble sending mail, try configuring smtp use port 25 (with ssl).

you should using try/catch block - if sendmail failing error, can print_r or var_dump see exception message contains.

i should admit haven't ever used sendmail directly; found rmail library lot easier use:

<?php     require_once( root . ds . "libs" . ds . "rmail" . ds . "rmail.php" );      // instantiate new html mime mail object     $mail = new rmail();      $mail->setsmtpparams($host = 'smtp.gmail.com', $port = 587, $helo = null, $auth = true, $user = 'gmail address', $pass = 'password');      // set , reply-to headers     $mail->setfrom( "proper name <send email address>" );     $mail->setreturnpath( "reply email address" );      // set subject     $mail->setsubject( 'email subject/title' );      $html = 'you email message content';      // create html e-mail     $mail->sethtml( $html );      // send e-mail     $result = $mail->send( array( 'target email address' ) ); ?> 

i can track down library somewhere if you'd rather use snippet above.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -