- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我花了好几天时间才获得正确的设置,所以我想我应该发布一个适用于 Bluehost 的 php 脚本。在初始测试中,使用 isSMTP 比使用 isMAIL 更快。
<?php
require_once '../includes/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "box1311.bluehost.com"; // specify bluehost as outgoing server
$mail->SMTPSecure = "tls"; // sets the prefix to the server do not use ssl
$mail->SMTPDebug = 3; // comment out if you don't need debug info
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "USER@EXAMPLE.COM"; // SMTP username (your email account)
$mail->Password = "PASSWORD"; // SMTP password
$mail->Port = 25;
$mail->From = 'USER@EXAMPLE.COM';
$mail->FromName = "USER@EXAMPLE.COM";
$mail->AddAddress('CLIENT@gmail.com');
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = 'test message';
$body = '<!DOCTYPE html>
<html><header>
</header>
<body lang=EN-US>
<div style="text-align:center">
<h2>this is a test</h2>
</div>
</body>
</html>';
$mail->Body = $body;
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send()){
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo '<h1>message sent</h1>';
}
?>
最佳答案
这段代码对我有用。
include "phpmailer/class.phpmailer.php";
include "phpmailer/class.smtp.php";
$email_user = "email@host.com";
$email_password = "pass123";
$the_subject = "Title";
$from_name = "Sender";
$phpmailer = new PHPMailer();
// ---------- datos de la cuenta de correo -----------------------------
$phpmailer->Username = $email_user;
$phpmailer->Password = $email_password;
//---------------------------------------------------------------------
$phpmailer->SMTPSecure = 'tls';
$phpmailer->Host = "box6171.bluehost.com";
$phpmailer->Port = 26;
//$phpmailer->SMTPDebug = 2;
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true;
$phpmailer->setFrom($phpmailer->Username,$from_name);
$phpmailer->AddAddress("to@host.com");
$phpmailer->Subject = $the_subject;
$phpmailer->Body .="<h1 style='color:#3498db;'>Attachment:</h1>";
$phpmailer->Body .= "<h3>".$attach1."</h3>";
$phpmailer->AddAttachment($attach, "attach1");
$phpmailer->AddBCC("hidecopy@host.com", "bcc1");
$phpmailer->IsHTML(true);
$enviado = $phpmailer->Send();
if($enviado) {
echo 'email send successful';
}
关于php - 如何在 Bluehost 上使用 phpMailer isSMTP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39731844/
如何安装 phpMailer在共享托管环境中?我需要将其用于用户的电子邮件验证和密码更改。 最佳答案 您可以在这里下载:https://github.com/PHPMailer/PHPMailer 将
当我使用 phpmailer 通过 Gmail 发送时,电子邮件需要很长时间才能发送,而且有时发送不成功。我正在使用 XAMPP 作为本地主机。 这是我的代码: if($_POST['submit']
我正在使用 PHPMailer 发送一些简单的电子邮件,但是函数 SetFrom() 似乎不起作用,即使我使用的代码直接来自 phpmails 文档 ( http://phpmailer.worxwa
使用 PHP 邮件程序 6.0.6 版 我知道类似的问题得到了回答,但我的情况不同。 我已经成功配置了它运行良好的脚本;我正在接收邮件,然后突然之间没有任何变化,它开始向我抛出这个错误。 错误
我可以生成 pdf 以便轻松查看和下载。我正在尝试发送一封附有 pdf 的电子邮件。我已经连续几天浏览谷歌了几个小时,没有什么比这个链接更让我更接近了,sending an email attachm
我可以生成 pdf 以便轻松查看和下载。我正在尝试发送一封附有 pdf 的电子邮件。我已经连续几天浏览谷歌了几个小时,没有什么比这个链接更让我更接近了,sending an email attachm
由于错误,我无法收到确认电子邮件。这是我的 PhpMailer 错误。 fatal error :未捕获错误:在 C:\xampp\htdocs\Web\PHPMailer\PHPMailer.php
这个问题在这里已经有了答案: SMTP connect() failed PHPmailer - PHP (17 个答案) 关闭 7 年前。 这是我在网上引用了很多之后从本地主机发送电子邮件的代码。
我写了一个 PHP 脚本,可以发送邮件。我从“mail@something.com”发送它们并将“返回路径”设置为“bounce@something.com”,但我仍然收到退回邮件到发件人邮件(“ma
我使用 php curl() 函数从服务器 A 连接到邮件服务器 B 以发送邮件。 $body = "body\n\nmore body\nmore body\n\nmore body\n\n"; $
PHPMailer 只是在发送电子邮件时挂起。我逐行注释了所有代码,一切正常,直到到达 如果(!$邮件->发送()) 此时页面进入旋转状态 - 没有错误消息或任何其他错误指示。我想我拥有所有必需的
我在问这里之前阅读了一些其他问题,因为其他答案没有回应我的问题。 我有一个用 php 定制的 cms。例如,如果我插入一个新的付款,脚本会向所有管理员用户发送一个通知: function insert
我用 Ubuntu 和 DigitalOcean 构建了一个 droplet,我正在尝试将它配置为使用 SMTP 发送电子邮件。 我知道 DigitalOcean 通过 IPv6 而不是通过 IPv4
我是 PHP 的新手。我从这里下载了一个 phpmailer 脚本(带有文件)-> phpmailer 我正在使用 XAMPP,我将文件定位在: \htdocs\QMS\phpmailer 我的 ph
我这里有一个大问题! 我需要向所有订阅者发送时事通讯(大约 1200) 问题是它只将时事通讯发送给其中的 150-180。 我有一个在 php 中实现的脚本,它使用 PhpMailer() 类将时事通
是否可以使用phpmailer发送异步电子邮件? 常规邮件发送代码段如下: $mail->Send(); PHP在继续之前等待Send()返回结果。是否有可能使phpmailer立即返回结果,而无需等
我有这样一种情况,我发送了两封不同的电子邮件,一封给客户,另一封在成员接受任务后发送给成员。在函数中我调用了 2 个函数,一个发送给客户端,一个发送给成员。发生的情况是第二封电子邮件同时发送给成员(m
我正在使用 PHPMailer在我的网站上,但它返回一个错误: 您必须提供至少一个收件人电子邮件地址。 服务器正在运行 PHP 7。我查看了以下页面以寻找答案: PHP Mailer You must
我正在尝试配置 PHPMailer 我上传了 1 个文件,它是 class.phpmailer.php 并创建了另一个包含以下内容的 php 文件: IsSMTP(); // enable SMTP
使用 PHPMailer 向我的 Gmail 帐户发送电子邮件后,单击“邮件发送者”右侧的“显示详细信息”后,它会显示“yourhostingaccount.com”。这是一张图片: 我读过您可以使用
我是一名优秀的程序员,十分优秀!