php - How do I send an email from gmail within my app? -


i have following code. send confirmation email user click 'register' button. when click on register button database gets updated correct information doesn't send email.

email.php:

<?php include('class.phpmailer.php'); include('class.smtp.php'); $mail  = new phpmailer();    $mail->issmtp();  //gmail config $mail->smtpauth   = true;                  // enable smtp authentication $mail->smtpsecure = 'ssl';                 // sets prefix server $mail->host       = 'smtp.gmail.com';      // sets gmail smtp server $mail->port       = 465;                   // set smtp port gmail server $mail->username   = 'xxx@gmail.com';  // gmail username $mail->password   = 'yyy';            // gmail password //end gmail  $mail->from       = 'xxx@gmail.com'; $mail->fromname   = 'sys'; $mail->subject    = 'registration successful'; $mail->msghtml('you have been added system!');  $mail->addaddress($_post['emailaddress']); $mail->ishtml(true); // send html  if(!$mail->send()) {//to see if return message or value bolean     echo "mailer error: " . $mail->errorinfo; } else  echo "message sent!";  ?> 

this part of code email address from. have user inputs email address textbox. gets saved emailaddress

adduser.php:

<div class=""> <label style=""> email address </label> <input id="email address" type="email" name="emailaddress" value="">                           </div> 

my sql query goes here. include email.php file after it.

<?php . . .  include('./content/email.php'); ?> 

this button. when user clicks it, information gets stored , supposed send email.

 </select></div>  </div>  </div>    <br><br>    <input type="submit" class="btn btn-submit" value="add user">   </div> 


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -