• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

sending external mail with php mail()

dpleskuser

New Pleskian
Hi,

I recently moved to a dedicated windows server running plesk and am unable to send mail to external domains (it works great if I email an address on my own domain though).

Here's an example of a php file that would have worked previously (before switching to windows plesk) but no longer does...

<?php
ini_set("sendmail_from", "[email protected]");
mail("[email protected]","testSubject","testMessage");
echo "finished";
?>

I was looking through the server settings and various bits of documentation and I'm not clear on whether plesk requires an smtp server to be specified to send external mail?

Either way, right now the plesk page "External SMTP Server Settings" has both options checked ("Allow Plesk to send email notifications through this SMTP server" and "Use the mail server installed with Plesk and the default mail account created by Plesk"), but in terms of the DNS settings, everything goes through mail.mydomain.com (i.e. there's no "smtp.mydomain.com").

Sorry if that's unclear, but I'm really scratching my head on where to start with this problem, and I'm hoping that something above rings a bell with someone here! Thanks for any thoughts at all!

Dan
 
Just to add that I just found entries like the following in MailEnable's SMTP activity logs...

01/16/16 00:43:19 SMTP-IN 40F2B21D2C4B475DAFBD08D0E5BBFDF5.MAI 688 127.0.0.1 HELO HELO DSVR013493 250 Requested mail action okay, completed 43 17
01/16/16 00:43:19 SMTP-IN 40F2B21D2C4B475DAFBD08D0E5BBFDF5.MAI 688 127.0.0.1 MAIL MAIL FROM:<[email protected]> 250 Requested mail action okay, completed 43 43
01/16/16 00:43:19 SMTP-IN 40F2B21D2C4B475DAFBD08D0E5BBFDF5.MAI 688 127.0.0.1 RCPT RCPT TO:<[email protected]> 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. 235 36
01/16/16 00:43:19 SMTP-IN 40F2B21D2C4B475DAFBD08D0E5BBFDF5.MAI 688 127.0.0.1 QUIT QUIT 221 Service closing transmission channel 42 6
01/16/16 00:50:57 SMTP-IN 891E1BE921A449B88556B864CC3ADC9B.MAI 188 127.0.0.1 220 DSVR013493.home ESMTP MailEnable Service, Version: 8.60-- ready at 01/16/16 00:50:57 0 0
 
Just figured out the problem: MailEnable -> Servers -> Services & Connectors -> SMTP (right-click) -> Properties -> Relay tab -> I had to choose an "Allow Mail Relay" option of "Allow relay for local sender addresses". Now I can send to external mail addresses. So sorry, but not specifically a plesk problem!!
 
Hi,

Enabling the SMTP relay option for "Allow relay for local sender addresses" will open your MailEnable server for open relay. This will allow spammers to relay spam from server without any need to authenticate and potentially get your servers IP blacklisted. The more secure way to allow 127.0.0.1 to relay without authenticating is to enable "Allow privileged IP's can relay" and add the 127.0.0.1 IP to the "Deny all - Except those in the list" option.
 
Last edited:
Thanks very much Ian - had no idea about that possible security issue and everything still works great after implementing your suggestion.
 
Back
Top