PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello guys.
I'm facing a problem 4 using PHPmailer to send email.
error:
Message was not sent
Mailer Error: The following From address failed: epaymanager@163.com
My code:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
It wouldn't amaze me if the PHPMailer code is disallowing the domain 163.com based on a faulty regular expression. It may be a relaying problem but I'd expect a better error message if that's the case.
It wouldn't amaze me if the PHPMailer code is disallowing the domain 163.com based on a faulty regular expression. It may be a relaying problem but I'd expect a better error message if that's the case.
The problem is I also changed other domains, but I got same error.
an change host to localhot if you are running on the same machine
$mail->Host = "localhost";
Remember to use a valid email in the from. That should work. Try it an let us know.
I'm so sorry that it didn't work.
I guess it is because there's no SMTP server in my laptop.
And the email I filled in is valid.
the error also came out:
Warning: fputs(): supplied argument is not a valid stream resource in C:\xampp\htdocs\bsp\class.smtp.php on line 146
Warning: fgets(): supplied argument is not a valid stream resource in C:\xampp\htdocs\bsp\class.smtp.php on line 1024
Message was not sent
Mailer Error: The following From address failed: epay_manager@sina.com
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.mellorweb.co.uk"; // SMTP server
$mail->Username="website@mellorweb.co.uk";
$mail->Password="[ Of course I'm not putting the password in here ]";
$mail->SMTPAuth=true;
$mail->From = "From Email";
$mail->FromName = "From Name";
$mail->AddAddress("steve@mellorweb.co.uk");
$mail->Subject = "Subject";
$mail->Body = "Hello, this is a message form your website."
All it really relies on is getting the right SMTP settings. Of course there are some SMTP hosts that don't like you using their resources on your website so that might be where you're getting the problem. But the code is sound and PHPMailer is a good system once you've got it working.