diff --git a/README.md b/README.md index 4bfefa180..0ecfa5dcc 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,7 @@ $mail->Password = 'secret'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to -$mail->From = 'from@example.com'; -$mail->FromName = 'Mailer'; +$mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient $mail->addAddress('ellen@example.com'); // Name is optional $mail->addReplyTo('info@example.com', 'Information'); diff --git a/docs/extending.html b/docs/extending.html index ec2b85108..4466a1de9 100644 --- a/docs/extending.html +++ b/docs/extending.html @@ -18,10 +18,9 @@

1. Advanced Example

$mail = new PHPMailer(); -$mail->From = 'list@example.com'; -$mail->FromName = 'List manager'; -$mail->Host = 'smtp1.example.com;smtp2.example.com'; -$mail->Mailer = 'smtp'; +$mail->setFrom('list@example.com', 'List manager'); +$mail->Host = 'smtp1.example.com;smtp2.example.com'; +$mail->Mailer = 'smtp'; @mysqli_connect('localhost','root','password'); @mysqli_select_db("my_company"); diff --git a/examples/code_generator.phps b/examples/code_generator.phps index 341a7d674..23458561b 100644 --- a/examples/code_generator.phps +++ b/examples/code_generator.phps @@ -45,9 +45,11 @@ $example_code .= "\n\n\$results_messages = array();"; $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');"; class phpmailerAppException extends phpmailerException { @@ -117,21 +119,19 @@ try { try { if ($_POST['From_Name'] != '') { $mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']); - $mail->From = $_POST['From_Email']; - $mail->FromName = $_POST['From_Name']; + $mail->setFrom($_POST['From_Email'], $_POST['From_Name']); $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");"; - $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";"; - $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Name'] . "\";"; + $example_code .= "\n\$mail->setFrom(\"" . + $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");"; } else { $mail->addReplyTo($_POST['From_Email']); - $mail->From = $_POST['From_Email']; - $mail->FromName = $_POST['From_Email']; + $mail->setFrom($_POST['From_Email'], $_POST['From_Email']); $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\");"; - $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";"; - $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Email'] . "\";"; + $example_code .= "\n\$mail->setFrom(\"" . + $_POST['From_Email'] . "\", \"" . $_POST['From_Email'] . "\");"; } if ($_POST['To_Name'] != '') { @@ -162,7 +162,7 @@ try { } $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')'; $example_code .= "\n\$mail->Subject = \"" . $_POST['Subject'] . - '(PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";'; + ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";'; if ($_POST['Message'] == '') { $body = file_get_contents('contents.html'); @@ -594,4 +594,4 @@ if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") { - \ No newline at end of file +