"using gmail smtp to send email with php" Code Answer

3

use this class: http://www.phpclasses.org/package/14-php-sends-e-mail-messages-via-smtp-protocol.html

the sample code i use:

require("smtp/smtp.php");
require("sasl/sasl.php");
$from = 'youraddress@gmail.com';
$to = 'some@email.com';

$smtp=new smtp_class;
$smtp->host_name="smtp.gmail.com";
$smtp->host_port='465';
$smtp->user='youraddress@gmail.com';
$smtp->password='xxxxxxxxx';
$smtp->ssl=1;
$smtp->debug=1;       //0 here in production
$smtp->html_debug=1; //same

$smtp->sendmessage($from,array($to),array(
"from: $from",
"to: $to",
"subject: testing manuel lemos' smtp class",
"date: ".strftime("%a, %d %b %y %h:%m:%s %z")
),
"hello $to,nnit is just to let you know that your smtp class is working just fine.nnbye.n"));
By LS_ on August 16 2022

Answers related to “using gmail smtp to send email with php”

Only authorized users can answer the Search term. Please sign in first, or register a free account.