• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

PHP sendmail

P

pkonstan

Guest
In the Knowledge base article (http://kb.swsoft.com/article_22_1395_en.html), it says one of the issues with PHP not sending mail relates to the wrapper and symbolic links.

- When mail is sent from PHP script, PHP
usually uses 'sendmail' binary. Plesk has it's own sendmail wrapper, so
/usr/sbin/sendmail should be symbolic link which points to "$QMAIL_ROOT_D/bin/sendmail", please check it.

How do I check if it is a symbolic link and what would I do to create one if it is not?
 
run this command
ls -alh /usr/sbin/sendmail

and you should get output like this. (The arrow shows a symlink)

lrwxrwxrwx 1 root root 23 Apr 19 10:34 /usr/sbin/sendmail -> /var/qmail/bin/sendmail
 
You will probably have to move /usr/sbin/sendmail first:

mv /usr/sbin/sendmail /tmp/sendmail

To make a symlink:

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

:D
 
same problem

I'm having probably the same problem. Not sure what the above means however i get this as my result

lrwxrwxrwx 1 root root 21 Dec 12 03:36 /usr/sbin/sendmail -> /etc/alternatives/ mta

/etc/alternatives/ mta really doesn't sound good to me. Then again I have no clue what i'm doing... So is plesk the culprit here? linux? something in a .htaccess file?

working perfectly to not at all just doesn't seem right to me.
 
I am having the exact same problem and this is getting tiresome. The /etc/alternatives/mta is another sym link to qmail
 
Prior to getting any replies on this site, my research on the Web and the Plesk site, led me down this path that worked.

I found these first two steps from an article I found in the Plesk Knowledge Base. http://kb.swsoft.com/article_22_144_en.html

1) 127.0.0.0/8 network is added to white list in Plesk CP (Server-> Mail -> White List)

2) Make sure that /usr/sbin/sendmail and /usr/lib/sendmail are a
symbolic links to Plesk sendmail binary (/var/qmail/bin/sendmail).

When I got to the second step, I did the following:

1. Log in as ROOT to your server and do the following:
2. Issue these root commands:
a. cd /usr/sbin (this changes to the directory)
b. readlink sendmail (this displays where the symbolic link points.)
> In my case it was pointing to: /etc/alternatives/mta/sendmail
> That is good.
c. cd /usr/lib (change to next directory)
d. readlink sendmail (again, show where it points).
> In my case, nothing displayed because the file/link did not exist.
> I then ran the command to create a symbolic link
> ln -s /etc/alternatives/mta sendmail
> Now when I use readlink sendmail it gives me this symbolic link
3. That was it… My sendmail from within PHP now worked.
 
nope

ok

1) 127.0.0.0/8 network is added to white list in Plesk CP (Server-> Mail -> White List)

2) Make sure that /usr/sbin/sendmail and /usr/lib/sendmail are a
symbolic links to Plesk sendmail binary (/var/qmail/bin/sendmail).

step 1 was done, step 2 i did need to add the symbolic link "sendmail" to /usr/lib

restarted it, still is not working

it has been suggested to reinstall qmail as the php install messes it up. I being less than novice at this with hundreds of domains at stake would rather avoid this. My linux guy just wrecked his bike, poor guy, he's going to live, i don't have many other details.

anyone else?
 
Solution!!

Everyone...

i gave up on the linux side and decided this was possibly a mail header issue and i was right.

putenv ("QMAILUSER=USER");
putenv ("QMAILNAME=FULL_USER_NAME");
putenv ("QMAILHOST=DOMAIN");
$headers = "From: name <email>\n";
$headers .= "Reply-To: name <email>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain;charset=us-ascii\r\n";

$to="emails";
$subject = "Testing email";
$body = "test";
$err = mail($to, $subject, $body, $headers);

this works for everything!

http://kb.swsoft.com/article_51_1251_en.html

is where i got the header code from. I modified it a bit.

on a side note, i NEVER contribute to forums in a constructive way, this would be the first solution i've come up with to date.

I hope this saves some of you some hair...
 
Back
Top