前几天我遇到了GoDaddy托管网站的一些问题.我打电话给他们的技术支持,与我交谈过的人建议我的问题与我在Windows机箱上的问题有关,并且可以在Linux机器上提供更好的服务.对此没有意见,我同意了,他们让我转过身来.
在转换之后,我的PHPMailer功能让我感到厌烦.我有几个月的工作,所以我知道我的设置是准确的.我已经向GoDaddy证实,我试图发送的帐户并没有改变他们的观点.用户端未进行任何更改(如新密码).最重要的是,唯一不同的是我的网站现在托管在Linux服务器上.而已.
因此,我认为我的PHPMailer困难必须与此相关,因为在服务器转换发生的确切时刻,已经工作了几个月的脚本失败太巧合了.但为什么?我花了一个小时的技术支持,他们发现服务器设置没有任何问题.我们验证了我的设置(只是为了好玩).一切看起来都不错,但是当我发送电子邮件时,我收到此错误:
SMTP -> ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed.
关于此类错误的帖子很多,而且几乎所有这些都与第一次设置错误的设置或省略设置的人有关.但是,我知道我的设置是完整和准确的,因为我已成功使用它们好几个月.为了完整起见,我会在这里张贴它们:
$mail = new PHPMailer();
$mail->IsSMTP(); //telling the class to use SMTP
$mail->isHTML(true);
$mail->Host = "smtpout.secureserver.net"; //also tried "relay-hosting.secureserver.net"
$mail->WordWrap = 50;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "example@email.com";
$mail->Password = *******;
$mail->Subject = "Test Email";
$mail->SMTPDebug = 1;
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法为什么会这样?是否存在技术支持人员可能不知道的某些服务器设置,例如在我的php.ini文件中?和我一起工作过的那个人尽力帮助我,但他可能根本不知道什么.
任何帮助表示赞赏.如果我能提供任何其他信息,请告诉我.谢谢!
编辑:我还应该提一下我做的其他一些尝试.无论怎样,我都得到相同的结果.
1)使用端口587的TLS 2)没有使用端口25,80和3535的SSL.2)我自己的gmail地址修改服务器,用户名,密码等.
遇到过应该从具有自签名证书的邮件服务器发送电子邮件的问题,我得到的错误是:
PHP Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in class.smtp.php on line 327.
Run Code Online (Sandbox Code Playgroud)
有没有人遇到类似的东西?
编辑:
我还尝试设置stream_context参数(参数:SSL上下文选项):
$options['ssl']['verify_peer'] = false;
$options['ssl']['verify_peer_name'] = false;
$options['ssl']['allow_self_signed'] = true;
Run Code Online (Sandbox Code Playgroud)
没有运气,它仍然失败,出现与上面指出的相同的错误.
谢谢.
基本上我正试图这样做.
http://www.xeweb.net/2009/12/31/sending-emails-the-right-way-using-phpmailer-and-email-templates/
这是我的代码
<?php
include('class.phpmailer.php'); // Retrieve the email template required
$message = file_get_contents('mail_templates/sample_mail.html');
$message = str_replace('%testusername%', $username, $message);
$message = str_replace('%testpassword%', $password, $message);
$mail = new PHPMailer(); $mail->IsSMTP(); // This is the SMTP mail server
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = 'mygmailid@gmail.com';
$mail->Password = 'mypassword';
$mail->SetFrom('fromgmail@gmail.com', 'Pricol Technologies');
$mail->AddAddress('addaddress@gmail.com');
$mail->Subject = 'Your account information';
$mail->MsgHTML($message);
$mail->IsHTML(true);
$mail->CharSet="utf-8";
//$mail->AltBody(strip_tags($message));
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
?>
Run Code Online (Sandbox Code Playgroud)
<html> …Run Code Online (Sandbox Code Playgroud) include_once('C:\Inetpub\wwwroot\php\PHPMailer\PHPMailerAutoload.php');致命错误:第151行的C:\ Inetpub\wwwroot\php\index.php中找不到类'PHPMailer'
我把它PHPMailerAutoload.php放在与我的脚本相同的目录中.
有人可以帮我弄这个吗 ?
我正在尝试在提交表单时发送电子邮件.我正在使用PHPMailer使用以下配置发送邮件.
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'mail.example.in';
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = 'user@example.in';
$mail->Password = 'password';
$mail->setFrom("user@example.in" , "User");
$mail->addAddress('receiver@example.in', 'Receiver');
$mail->addBCC('anotheruser@somedomain.com', 'Another user');
$mail->AddReplyTo('user@example.in', 'User');
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if($mail->send())
echo "Your request has been received. We will soon contact you.";
else echo "Unable to send your request. Please try again";
Run Code Online (Sandbox Code Playgroud)
这在localhost中工作正常.但是,当我将它部署到我的服务器(example.in)时,我得到以下异常.
SMTP ERROR: Failed to connect to server: Connection timed out (110)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Run Code Online (Sandbox Code Playgroud)
- 编辑 -
我尝试使用telnet命令连接到SMTP服务器,但我无法添加收件人.我收到以下错误? …
我在localhost上运行相同的php脚本 - 我的PC与XAMPP和托管服务器上运行.它适用于我的PC,但不适用于托管服务器.
当我从托管服务器发送它时,我得到以下输出:
SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data
SMTP -> ERROR: RCPT not accepted from server: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message. dev.camppage.com 550-(patchvalues.com) [205.234.141.238]:50958 is not permitted to relay through 550 this server without authentication.
SMTP Error: The following recipients failed: jdorner4@gmail.com FAILED
Run Code Online (Sandbox Code Playgroud)
我怀疑有一个配置设置需要在服务器上更改,但我不知道哪一个.任何建议将不胜感激!
这是代码:
function send_gmail ($recipients, $subject, $message, $attachment_filenames = array())
{
global $email_address, $email_password, $email_name; …Run Code Online (Sandbox Code Playgroud) 当我试图通过PHPMailer发送邮件时,我收到此错误消息.我的代码如下:
<?
require("phpmailer/class.phpmailer.php"); // First we require the PHPMailer libary in our script
$mail = new PHPMailer(); // Next we create a new object of the PHPMailer called $mail
$mail->From = "rajasekar.kcet@gmail.com";
$mail->FromName = "Rajasekar";
$mail->AddAddress("rajasekar.kcet@gmail.com"); // This is the adress to witch the email has to be send.
$mail->Subject = "First PHP Email message"; // This is the subject of the email message.
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHP."; // This is the …Run Code Online (Sandbox Code Playgroud) 我正在使用PHP邮件程序将在线表单直接发送到电子邮件.我想编辑这样的表单:
$message = '<p>The following request was sent from: '</p>;
$message .= '<p>Name: '.$name.'</p><br />';
$message .= '<p>Phone: '.$phone.'</p><br />';
$message .= '<p>Email: '.$email.'</p><br />';
Run Code Online (Sandbox Code Playgroud)
然而,在我收到回电子邮件,我得到的<p>,<br />等不格式化我想要的,但实际的HTML.它一直对我有用,然后我意识到我正在使用股票PHP邮件功能.不确定PHP邮件程序是否有不同的参数或者我是否只是在这里丢失了一小部分?
我在哪里设置text/html的标题?
$mail = new PHPMailer();
$mail -> IsSMTP();
$mail -> Host = "---";
$mail -> Port = 25;
$mail -> SMTPAuth = false;
$mail -> Username = EMAIL_USER;
$mail -> Password = EMAIL_PASS;
$mail -> FromName = $from_name;
$mail -> From = $from;
$mail -> Subject = $subject;
$mail …Run Code Online (Sandbox Code Playgroud) 我正在使用PHPMailer通过SMTP通过我们公司的Gmail帐户发送邮件的网站上开发软件.通过该软件,客户注册该站点并收到收据和视频票.注册时,每位客户发送两封电子邮件.然后,在事件开始之前,我们想要重新发送所有视频票.
我想知道发送电子邮件的限制是什么.我们可以使用PHPMailer通过SMTP每天每小时,每小时发送多少封电子邮件?
谢谢.
更新:
我们正在使用Google Apps开展业务
电流我使用phpmailer发送邮件.现在如何使用DKIM密钥在phpmailer中发送电子邮件
我在phpmailer类文件中搜索,我找到了下面的代码
/**
* DKIM selector.
* @type string
*/
public $DKIM_selector = '';
/**
* DKIM Identity.
* Usually the email address used as the source of the email
* @type string
*/
public $DKIM_identity = '';
/**
* DKIM passphrase.
* Used if your key is encrypted.
* @type string
*/
public $DKIM_passphrase = '';
/**
* DKIM signing domain name.
* @example 'example.com'
* @type string
*/
public $DKIM_domain = '';
/**
* DKIM private key file …Run Code Online (Sandbox Code Playgroud)