How can I send emails through gmail? I use a laptop host and apply for the email server created in it. then, I can send a message with phpmailer. I just want to change it to "stackoverflow" because I lost my mail via gmail. comques... {code ...... how can I send emails through gmail?
I use a laptop host and apply for the email server created in it. then, I can send a message with phpmailer.
I just want to change it to mail via gmail.
So I lost my account.
Here I am: http://stackoverflow.com/ques...
$mail = new PHPMailer();$mail->IsSMTP(); // enable SMTP$mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = "smtp.gmail.com";$mail->Port = 465; $mail->IsHTML(true);$mail->Username = "***@gmail.com";$mail->Password = "***";$mail->SetFrom("***@gmail.com");$mail->Subject = "Test";$mail->Body = "hello";$mail->AddAddress("xxxxxxxx@gmail.com"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }
SMTP -> ERROR: Failed to connect to server: Connection timed out (110) The following From address failed: ***@gmail.com : Called Mail() without being connected Mailer Error: The following From address failed: ***@gmail.com : Called Mail() without being connected
Are you sure you want to disable gmail authentication?
It turns out that bluehost cannot use gmail.
Reply content:
How can I send emails through gmail?
I use a laptop host and apply for the email server created in it. then, I can send a message with phpmailer.
I just want to change it to mail via gmail.
So I lost my account.
Here I am: http://stackoverflow.com/ques...
$mail = new PHPMailer();$mail->IsSMTP(); // enable SMTP$mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = "smtp.gmail.com";$mail->Port = 465; $mail->IsHTML(true);$mail->Username = "***@gmail.com";$mail->Password = "***";$mail->SetFrom("***@gmail.com");$mail->Subject = "Test";$mail->Body = "hello";$mail->AddAddress("xxxxxxxx@gmail.com"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }
SMTP -> ERROR: Failed to connect to server: Connection timed out (110) The following From address failed: ***@gmail.com : Called Mail() without being connected Mailer Error: The following From address failed: ***@gmail.com : Called Mail() without being connected
Are you sure you want to disable gmail authentication?
It turns out that bluehost cannot use gmail.
The connection times out. what about the host? can I access the google service?
First test your code locally to see if there is any problem. if there is no problem, consult the VM supplier.
The error message indicates that the network of the code server cannot access the gmail mail server.
Not connected to '$ mail-> Host = "smtp.gmail.com ";'
Smtp POP3 or IMAP protocol