<?php
/*
* test_smtp_gmail.php
*
* @(#) $Id: test_smtp_gmail.php,v 1.2 2022/10/28 09:12:54 mlemos Exp $
*
*
*/
require("smtp_gmail.php");
$message_object->smtp_debug = 1;
$message_object->smtp_html_debug = 0;
$message_object->smtp_user = ''; $smtp_user_line = __LINE__;
$message_object->smtp_password = ''; $smtp_password_line = __LINE__;
$message_object->smtp_token = ''; $smtp_token_line = __LINE__;
$message_object->smtp_authentication_mechanism = ''; $smtp_authentication_mechanism_line = __LINE__;
$message_object->smtp_token = ''; $smtp_token_line = __LINE__;
if($message_object->smtp_user === '')
exit('Please set the Gmail account email address in the line '.$smtp_user_line."\n");
if($message_object->smtp_password === '')
{
if($message_object->smtp_authentication_mechanism === 'XOAUTH2')
{
if($message_object->smtp_token === '')
{
exit('Please set the Gmail OAuth application token in the line '.$smtp_token_line."\n");
}
}
else
exit('Please set the Gmail account password in the line '.$smtp_password_line."\n");
}
/*
* Change these variables to specify your test sender and recipient addresses
*/
$from = $message_object->smtp_user;
$to = "mlemos@acm.org";
$subject = "Testing smtp_mail function";
$message = "Hello,\n\nThis message is just to let you know that the smtp_mail() function is working fine as expected.\n\n$from";
$additional_headers = "From: $from";
$additional_parameters = "-f ".$from;
if(gmail_smtp_mail($to,$subject,$message,$additional_headers,$additional_parameters))
echo "Ok.";
else
echo "Error: ".$message_object->error."\n";
?>
|