• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Can't Send Email By PHP Mail Function

shinichi kudo

Basic Pleskian
i installed new vps and has about 6 domains on it ,, updated to latest version
the main domain i've linked it's DNS to google Apps

the other domains when i create php script to send mail ,, it give me result (1) but email din't sent
and i sometimes see error

PHP Warning: mail(): SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.

could any one help me please ?
 
Hi shinichi kudo,

you are trying to send mails, without authentification over an SMTP server, which requires authentification. Pls. consider to use scripts, as for example:

Code:
// Data received from POST request
$name = stripcslashes($_POST['name']);
$emailAddr = stripcslashes($_POST['email']);
$issue = stripcslashes($_POST['issue']);
$comment = stripcslashes($_POST['message']);
$subject = stripcslashes($_POST['subject']);   

// Send mail
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP

// SMTP Configuration
$mail->SMTPAuth = true;                  // enable SMTP authentication
$mail->Host = "myhost"; // SMTP server
$mail->Username = "[email protected]";
$mail->Password = "yourpassword";           
//$mail->Port = 465; // optional if you don't want to use the default

$mail->From = "[email protected]";
$mail->FromName = "My Name";
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($issue . "<br /><br />" . $comment);

// Add as many as you want
$mail->AddAddress($emailAddr, $name);

// If you want to attach a file, relative path to it
//$mail->AddAttachment("images/phpmailer.gif");             // attachment

$response= NULL;
if(!$mail->Send()) {
    $response = "Mailer Error: " . $mail->ErrorInfo;
} else {
    $response = "Message sent!";
}

$output = json_encode(array("response" => $response)); 
header('content-type: application/json; charset=utf-8');
echo($output);

PHPMailer at sourceforge.net => https://sourceforge.net/projects/phpmailer/
 
Thanks peteSDG and UFHH01
I installed plesk with all default values
I think it setup mailenable program

Now if my server address is
Srv1.mydomain.com
And i installed 3 domains on it like this
Www.dom1.com
Www.dom2.com
Www.mydomain.com

As i know each domain is the smtp for it's emails that i created

How i could configure the relay please to make the mail function in php to work as there's scripts like joomla and forums that use this function and i can't use the phpmailer
 
Ok, first have a look in Plesk control panel Tools & Settings, Mail Server Settings.

Ensure you have 127.0.0.1 added to your list where is says "Use no relay restrictions for the following networks:"

That should update the MailEnable SMTP settings.

Double check to see if this has worked by opening the MailEnable Console, Open Servers > Localhost, Services and Connectors, Right Click SMTP.

Select the Relay tab from the SMTP properties window, make sure "Allow relay for privileged IP ranges" is ticked.

Press the "Privilieged IP's" button, maike sure the "Denied Relay Rights" option is selected and that your server's internal address is added in the box labeled "Execept those listed below", you may also need to add any other internal IP addresses that you're using (this is common if your server is behind a router/firewall and it's using NAT).
 
i did and still nothing happen
i tried run MEinstall.exe to reset mailenable also nothing happen (still can't sent emails"
i noticed that also when i open the webmail client (hord) and login and try to sent new email it say sent but i didn't get anything sent actually ??

i've dedicated ip for each of 2 domain and 2 dmains on shared ip ,, as i explaned before
could help me to know how to fix this

this is screen shots from all my settings ,,

http://prntscr.com/bd2r0p
1.png
http://prntscr.com/bd2rif
2.png
http://prntscr.com/bd2rr1
3.png
http://prntscr.com/bd2rzy
4.png
http://prntscr.com/bd2s7i
5.png
 
I block icmp protocol by the cisco firewall and udp for protection from ddos attack ... could this be the reason for email not working

Please if any one could help me ... my settings was in images in previous post
 
could any one help here ?? what make email not working ??
i use OVH servers ,, cloud windows ,, configured harware firewall

to block:
TCP/Fragments established
UDP
GRE
ICMP

to allow:
TCP
TCP/Fragments
TCP/Fragments syn

and all my configuration you see in my images in the previous post
i did and still nothing happen
i tried run MEinstall.exe to reset mailenable also nothing happen (still can't sent emails"
i noticed that also when i open the webmail client (hord) and login and try to sent new email it say sent but i didn't get anything sent actually ??

i've dedicated ip for each of 2 domain and 2 dmains on shared ip ,, as i explaned before
could help me to know how to fix this

this is screen shots from all my settings ,,

http://prntscr.com/bd2r0p
View attachment 11139
http://prntscr.com/bd2rif
View attachment 11140
http://prntscr.com/bd2rr1
View attachment 11141
http://prntscr.com/bd2rzy
View attachment 11142
http://prntscr.com/bd2s7i
View attachment 11143

still can't sent mail even from the mail client in the plesk control panel
could any one help me ??
 
Back
Top