phpmailer

PHPMailer to use Gmail as SMTP server.Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host

久未见 提交于 2019-11-26 14:29:25
问题 i am trying to use phpMailer to send confirmation messages to users via email. my code is this: <?php include("class.phpmailer.php"); include("class.smtp.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "ssl://smtp.gmail.com"; // specify main and backup server $mail->Port = 465; // set the port to use $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "sender@gmail.com"; // your SMTP username or your gmail username $mail->Password

phpmailer - The following SMTP Error: Data not accepted

淺唱寂寞╮ 提交于 2019-11-26 14:26:36
问题 I'm trying to figure out this issue for 6 hours. But there is nothing to make sense. Here is the scenario; There is a well formatted HTML template. $mail_body = ' <b>Message Num :</b> 769<br /> <b>Message Date :</b> 2013-04-08 09:03:21<br /> <b>Name :</b> John Doe<br /> <b>Phone :</b> 123456789<br /> <b>E-mail :</b> abcdf@somedomain.com<br /> <b>Message :</b> Here is the message info<br /> '; Here is the array of recipients' mails; $recipients = array("abc@something.com","xyz@somtehing.com");

PHPMailer 发送邮件 gmail注意事项

99封情书 提交于 2019-11-26 14:02:32
gmail 注意 1.ssl 2.端口465 3.打开IMAP https://mail.google.com/mail/u/0/#settings/fwdandpop 4.开启调试 5.邮件可能直接进了垃圾箱 配置 'SP_MAIL_ADDRESS' => 'xxx@gmail.com', 'SP_MAIL_SENDER' => 'xxx@gmail.com', 'SP_MAIL_SMTP' => 'smtp.gmail.com', 'SP_MAIL_SMTP_PORT' => '465', 'SP_MAIL_LOGINNAME' => 'xxx@gmail.com', 'SP_MAIL_PASSWORD' => 'xxx', 发送 /** * 发送邮件 * @param string $address * @param string $subject * @param string $message * @return array<br> * 返回格式:<br> * array(<br> * "error"=>0|1,//0代表出错<br> * "message"=> "出错信息"<br> * ); */ function sp_send_email($address,$subject,$message){ import("PHPMailer"); $mail=new

PHPMailer attachment, doing it without a physical file

本小妞迷上赌 提交于 2019-11-26 12:48:19
问题 So: // Setup mail class, recipients and body $mailer->AddAttachment(\'/home/mywebsite/public_html/file.zip\', \'file.zip\'); The AddAttachment function has four arguments: AddAttachment(PATH_TO_FILE, FILENAME, ENCODING, HEADER_TYPE) I used to use xmail() and when I added a attachment here, I passed the filename and the content, that should be in it. Like this: $xmail->addAttachment(\'myamazingfile.pdf\', $content); How can I make it work the same way, so when i call AddAttachment() from the

PHP mailer multiple address [duplicate]

可紊 提交于 2019-11-26 11:55:06
问题 Possible Duplicate: PHPMailer AddAddress() Here is my code. require(\'class.phpmailer.php\'); $mail = new PHPMailer(); $email = \'email1@test.com, email2@test.com, email3@test.com\'; $sendmail = \"$email\"; $mail->AddAddress($sendmail,\"Subject\"); $mail->Subject = \"Subject\"; $mail->Body = $content; if(!$mail->Send()) { # sending mail failed $msg=\"Unknown Error has Occured. Please try again Later.\"; } else { $msg=\"Your Message has been sent. We\'ll keep in touch with you soon.\"; } } The

Fatal error: Class &#39;PHPMailer&#39; not found

一笑奈何 提交于 2019-11-26 11:50:54
I tried : include_once('C:\Inetpub\wwwroot\php\PHPMailer\PHPMailerAutoload.php'); Fatal error: Class 'PHPMailer' not found in C:\Inetpub\wwwroot\php\index.php on line 151 I place the PHPMailerAutoload.php in the same directory as my script. Can someone help me with this ? all answers are outdated now. Most current version (as of Feb 2018) does not have autoload anymore, and PHPMailer should be initialized as follows: <?php require("/home/site/libs/PHPMailer-master/src/PHPMailer.php"); require("/home/site/libs/PHPMailer-master/src/SMTP.php"); $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail-

“SMTP Error: Could not authenticate” in PHPMailer

放肆的年华 提交于 2019-11-26 11:45:07
I'm using PHPMailer in a Simple Script For Send Email's Through Gmail, and I'm getting an "Unknown Error" (At least for me!): SMTP Error: Could not authenticate. Error: SMTP Error: Could not authenticate. SMTP server error: 5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 p38sm2467302ybk.16 I've read about Configure OpenSSL For SSL/TLS Connections, and I did it. Apache And PHP Are properly-Configured (With OpenSSL extension Running in PHP and mod_ssl running in Apache 2.2.16). This is The PHP Script: <?php require_once

Configure WAMP server to send email

你离开我真会死。 提交于 2019-11-26 11:34:39
Is there a way that I can configure the WAMP server for PHP to enable the mail() function? Configuring a working email client from localhost is quite a chore, I have spent hours of frustration attempting it. I'm sure someone more experienced may be able to help, or they may perhaps agree with me. If you just want to test, here is a great tool for testing mail locally, that requires almost no configuration: http://www.toolheap.com/test-mail-server-tool/ It worked right off the bat for me, hope this helps you. gianjey Install Fake Sendmail (download sendmail.zip ). Then configure C:\wamp

Error handling with PHPMailer

穿精又带淫゛_ 提交于 2019-11-26 11:21:19
I'm trying to use PHPMailer for a small project, but I'm a bit confused about error handling with this software. Hoping someone has experience with it. When I've set up an email and I use: $result = $mail->Send(); if(!$result) { // There was an error // Do some error handling things here } else { echo "Email successful"; } Which works fine, more or less. The problem is when there's an error, PHPMailer also seems to echo the error out, so if there's a problem, it just sends that info directly to the browser, essentially breaking any error handling I"m trying to do. Is there a way to silence

PHPMailer GoDaddy Server SMTP Connection Refused

谁都会走 提交于 2019-11-26 11:20:57
The other day I was experiencing some problems with my GoDaddy hosted site. I called their tech support, and the person that I spoke with suggested that my problems were related to the fact that I was on a Windows box and would be better served on a Linux box. Having no opinion on this, I agreed and they switched me over. In the wake of that transition, my PHPMailer functionality has deserted me. I have had this working for months, so I know that my settings are accurate. I have confirmed with GoDaddy that the account I am trying to send out of has not changed from their perspective. No