Как можно настроить SMTP электронной почты на веб-сайте WordPress
Как настроить SMTP на WordPress, на самом деле http://snvenkataraman.com/ этот веб-сайт переместить хостинг AWS-сервер. Используйте плагин-контактную форму 7 и плагин WP Mail SMTP, контактная форма не работает?! [] [2] моя конфигурация электронной почты:
С электронной почты: abc@gmail.com, От имени: abc
Mailer:
Путь возврата: параметры SMTP
Узел SMTP: smtp.gmail.com Порт SMTP:25 Шифрование: Аутентификация: Имя пользователя: abc@gmail.com Пароль: ****** Отправить тестовое электронное письмо: abc@gmail.com
1 ответ
Вы можете отправлять почту через Phpmailer. это код Просто добавьте файл Phpmailer в корневой каталог.
<?php
if (!isset($_SESSION)) {
session_start();
}
include_once('class.phpmailer.php');
$first = @$_POST['name'];
$last = @$_POST['last'];
$email = @$_POST['email'];
ob_start();
?>
<table width="361" align="center" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;">
<tr>
<td colspan="2" align="center" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #84848``4 thin; border-right:solid #848484 thin;">Contact Form</td>
</tr>
<tr>
<td width="21" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3">First Name</span></td>
<td width="39" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3"><?php echo $first; ?></span></td>
</tr>
<?php if ($last == 0) { ?>
<?php } else { ?>
<tr>
<td width="21" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3">Last Name</span></td>
<td width="39" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3"><?php echo $last; ?></span>
</td>
</tr>
<?php } ?>
<tr>
<td width="21" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3">E-Mail</span></td>
<td width="39" style="border-bottom:solid #848484 thin; border-left:solid #848484 thin; border-top:solid #848484 thin; border-right:solid #848484 thin;"><span class="style3"><?php echo $email; ?></span></td>
</tr>
</table>
<?php
$message = ob_get_clean();
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = false;
$mail->SMTPAuth = false;
$mail->SetFrom('do-not-reply@example.com', 'Example');
$mail->AddAddress('yts.sachin@gmail.com');
$mail->Subject = "Call Back Request From example.com";
$mail->MsgHTML($message);
if ($mail->Send())
echo $mail = "Mail Sent!";
else
echo $mail = "There is an error while sending a mail:" . $mail->ErrorInfo;
?>