【问题标题】:How can setting smtp email on wordpress website如何在 wordpress 网站上设置 smtp 电子邮件
【发布时间】:2016-08-28 01:45:20
【问题描述】:

如何在 wordpress 上设置 smtp,实际上是 http://snvenkataraman.com/ 这个网站移动托管 aws 服务器。由插件联系表格 7 和 WP Mail SMTP 插件使用, 联系表格不起作用? ![][2] 我的电子邮件配置是:

来自电子邮件:abc@gmail.com, 发件人姓名:abc

邮寄者:

返回路径: SMTP 选项

SMTP 主机:smtp.gmail.com SMTP 端口:25 加密: 验证: 用户名:abc@gmail.com 密码:****** 发送测试邮件:abc@gmail.com

【问题讨论】:

  • 当您通过 WP Mail SMTP 插件发送测试邮件时,您的收件箱中是否收到了该邮件?

标签: wordpress email web smtp setting


【解决方案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;
?>

【讨论】:

    猜你喜欢
    • 2018-06-11
    • 2020-09-08
    • 1970-01-01
    • 1970-01-01
    • 2014-10-14
    • 2020-01-13
    • 2013-12-18
    • 1970-01-01
    • 2011-09-09
    相关资源
    最近更新 更多