0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 01:52:15 +02:00

Rely on default debug output setting

This commit is contained in:
Marcus 2016-04-19 17:08:56 +02:00
parent a81898ca95
commit 78467895e5
6 changed files with 8 additions and 21 deletions

View File

@ -10,7 +10,6 @@ namespace PHPMailer\PHPMailer;
require '../vendor/autoload.php';
$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
$CFG['smtp_debugoutput'] = 'html';
$CFG['smtp_server'] = 'localhost';
$CFG['smtp_port'] = '25';
$CFG['smtp_authenticate'] = false;
@ -50,7 +49,6 @@ $example_code .= "\n\n\$results_messages = [];";
$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
$mail->CharSet = 'utf-8';
ini_set('default_charset', 'UTF-8');
$mail->Debugoutput = $CFG['smtp_debugoutput'];
$example_code .= "\n\n\$mail = new PHPMailer(true);";
$example_code .= "\n\$mail->CharSet = 'utf-8';";
$example_code .= "\nini_set('default_charset', 'UTF-8');";

View File

@ -22,9 +22,6 @@ $mail->isSMTP();
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use

View File

@ -21,8 +21,6 @@ try {
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587

View File

@ -19,8 +19,6 @@ $mail->isSMTP();
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587

View File

@ -19,14 +19,12 @@ $mail->isSMTP();
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//We don't need to set this as it's the default value
//$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address

View File

@ -22,9 +22,6 @@ $mail->isSMTP();
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.example.com';
@ -35,6 +32,7 @@ $mail->Port = 587;
$mail->SMTPSecure = 'tls';
//Custom connection options
//Note that these settings are INSECURE
$mail->SMTPOptions = array (
'ssl' => [
'verify_peer' => true,
@ -49,10 +47,10 @@ $mail->SMTPOptions = array (
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "username@example.com";
$mail->Username = 'username@example.com';
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
$mail->Password = 'yourpassword';
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
@ -67,9 +65,9 @@ $mail->Subject = 'PHPMailer SMTP options test';
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//send the message, check for errors
//Send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo "Message sent!";
echo 'Message sent!';
}