• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Sending email via PHP mail()

Chun..

New Pleskian
Hello,

I'm trying to send emails using the PHP mail() function. Although I'm getting the success message at the end of running the script below, I am not receiving the emails.

Code:
<?php
	$to = '[email protected]';
	$subject = 'Test Email';
	$message = 'Message';
	$mail_sent = mail($to, $subject, $message);
	if ($mail_sent) {
		echo 'success!';
	}
?>

I'm currently using: Parallels Plesk Panel v11.0.9_build110120608.16 os_Ubuntu 10.04
I figured the sendmail program has already been configured when I installed plesk, but I added some additional configuration directives (Power User View -> Websites & Domains -> Website Scripting and Security -> PHP Settings):

http://i.imgur.com/kKa77Yx.png

Code:
[mail function]
SMTP = mail.myserver.com
sendmail_from = [email protected]

Basically I'm trying to send the email using my smtp at mail.myserver.com from the email address [email protected]. Can anyone shed some light on how I can go about fixing this?

Thanks!
 
SMTP = localhost is the way it should be really, and that should not normally be changed. This is very likely why the email is not getting sent. Check your maillog /usr/local/psa/var/log/maillog (or similar) for errors.

But to get what you want, what you actually need is this:

Code:
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

Now it is possible that this may not get picked up in the individual domain's php.ini (as created via the PHP Settings section in the panel). Certain PHP settings are global, and can't be overridden. I don't think this is one of them though, so you should be OK.
 
Thanks a lot Faris. I replaced the additional configuration directives bit with the following and restarted the server:

Code:
[mail function]
SMTP = localhost
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

Works perfectly now.

SMTP = localhost is the way it should be really, and that should not normally be changed. This is very likely why the email is not getting sent. Check your maillog /usr/local/psa/var/log/maillog (or similar) for errors.

But to get what you want, what you actually need is this:

Code:
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

Now it is possible that this may not get picked up in the individual domain's php.ini (as created via the PHP Settings section in the panel). Certain PHP settings are global, and can't be overridden. I don't think this is one of them though, so you should be OK.
 
Back
Top