Here is code for sending thư điện tử from localhost after i referred a lot from online.

Bạn đang xem: Phpmailer

html form:

IsSMTP();$mail->Host = "ssl://"; // specify main & backup server$mail->SMTPAuth = true; // turn on SMTP authentication$mail->Username = "xxxx"; // SMTP username$mail->Password = "zzz"; // SMTP password$mailer->SMTPSecure = "ssl";$mailer->Port = 465;//587;$mail->AddAddress("xxx", "xx");$mail->SetFrom("xxx","xxxx");$mail->WordWrap = 50;$mail->IsHTML(true);$mail->Subject = "You have received feedback from your website!";$mail->MsgHTML($body);if(!$mail->Send())echo "Message could not be sent. ";echo "Mailer Error: " . $mail->ErrorInfo;exit;echo "Message has been sent";?>so when i run my code it shows error lượt thích this,

Message could not be sent.

Mailer Error: SMTP connect() failed. Https://

And i removed semicolon in this line ;extension=php_openssl.dll from the following files, và restart the xampp.

Xem thêm: Tăng Tốc Độ Tải Của Chrome, Cách Tăng Tốc Độ Download Trên Google Chrome

c/xampp/apache/bin/php.ini & c/xampp/php/php.inistill stays same error..

Xem thêm: Linux Là Gì? Tại Sao Lập Trình Hệ Điều Hành Linux Linux Là Gì

Note: I m new to php, but i want lớn know particular this one and fix the problem. Và I referred similar questions in stack, but it didn"t help me,

Can anybody help me to fix this?


php e-mail phpmailer
giới thiệu
edited Jun 20, 2020 at 9:12

111 silver badge
asked May 30, 2015 at 4:00

1,86044 gold badges2222 silver badges4848 bronze badges
| Show 8 more comments

1 Answer 1

Sorted by: Reset to default
Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)
It looks like your credentials for connecting to lớn your authentication has failed. I often send mail from my local & I found it that it"s a LOT easier to use another SMTP than gmail, like mandrillapp, free until 12,000 mails. There are a lot of things that I don"t understand in your code so I will chia sẻ mine.

SMTPDebug = 3; // Enable verbose debug output$mail->isSMTP(); // set mailer khổng lồ use SMTP$mail->Host = ""; // Specify main and backup SMTP servers$mail->SMTPAuth = true; // Enable SMTP authentication$mail->Username = "your"; // SMTP username$mail->Password = "mandrilapp_will_give_you_a_password"; // SMTP password$mail->Port = 587; // TCP port to connect to$mail->From = "your";$mail->FromName = "Test phpmailer";$mail->addAddress("who_are_you_sending"); // Name is optional$mail->isHTML(true); // Set e-mail format khổng lồ HTML$mail->Subject = "Here is the subject";$mail->Body = "This is the HTML message toàn thân in bold!";$mail->AltBody = "This is the body toàn thân in plain text for non-HTML mail clients";if(!$mail->send()) echo "Message could not be sent."; echo "Mailer Error: " . $mail->ErrorInfo; else echo "Message has been sent";Be sure to lớn have PHPMailer-master thư mục (you can download it from here) at the same level as your php file. This is how I link phpmailer. Hope it helps, if you have any questions, ask me!

edited May 30, 2015 at 4:26
answered May 30, năm ngoái at 4:23

Matthieu BoisjoliMatthieu Boisjoli
99722 gold badges99 silver badges1717 bronze badges
| Show 1
more phản hồi

Not the answer you're looking for? Browse other questions tagged php e-mail phpmailer or ask your own question.

The Overflow Blog
Featured on Meta
SMTP connect() failed PHPmailer - PHP
Error: Message body toàn thân Empty Using Php Mailer
PHPmailer: SMTP connect() failed (not working)
Sending Mail using PHP : SMTP ERROR
smtp connect failed in smtp mail
PHPMailer wont Work 000webhost
PHP mailer SMTP not working
Hot Network Questions more hot questions

Stack Overflow
Stack Exchange Network
Site thiết kế / biểu tượng logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. Rev2022.6.24.42450

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device & disclose information in accordance with our Cookie Policy.