0

here is the way iam send email. this does work fine in localhost.
if i put my website online will this method still work? or do i have to use different method of send email.

                $mail = new PHPMailer();
                $mail->IsSMTP(); 
                $mail->SMTPAuth   = true;                  // enable SMTP authentication
                $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
                $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
                $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
                $mail->Username = "randomperson@gmail.com";    //yourname@yourdomain
                $mail->Password = "12345";           //password

                //to
                $mail->AddAddress($email_p, $user_name_db);
                //subject
                $mail->Subject = "Forgot password";
                //html body
                $mail->IsHTML(true);
                $mail->Body = "Hello $first_name_db,<br/><br/>
                                Your Username is <u>$user_name_db</u> and your password is <u>$password_db</u><br/><br/>
                                    Thanks,<br/>randomperoson";
                //from
                $mail->From = "randomperoson@gmail.com";
                $mail->FromName = "random";
                $mail->wordWrap = 50;
                //send
                if(!$mail->send())
                {
                    $forgot_error .= "Mail error ".$mail->ErrorInfo;
                }
                else
                {
                    $forgot_error .= "E-mail has be sent to <b><u>$email_p</u></b>";
                }
3
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by radow
0

If on your site enabled smtp port, this method send will be work.
if no you must use other method of send email.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.