This topic is locked
[SOLVED]

Send Email Error

5/25/2022 3:52:39 PM
PHPRunner General questions
J
jacktonghk authorDevClub member

I am trying the send email function. I have set up the email server information in MISC->Email Settings. Then I created a button event with codes like below but when the event is triggered, an error showing SMTP connect() failed.

My question is do I need to install some kind of library in order for the email function works properly? Thank you.

Jack Tong

$email="test@gmail.com";
$from="test@gmail.com";
$msg="Hello there\nBest regards";
$subject="Sample subject";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];

Sergey Kornilov admin 5/25/2022

In 99% of cases this beinmg caused by incorrect SMTP settings. Another possible case - many email provides require FROM email address to be the same as login email address.

J
jacktonghk authorDevClub member 5/26/2022

I am sure I have the correct information and I use the same from email address as the email server login email address. Is there any way the I can test the connection and get the detail error from the server? Thanks.

Sergey Kornilov admin 5/26/2022

If you upload your project to Demo Account and contact supprot directly we can see if there is a more detailed record in there.

J
jacktonghk authorDevClub member 5/28/2022

The function works in demo account so it should be nothing to do with phprunner. But it still doesn't work on my computer, may need to check my firewall setting. Thanks Sergey!!