Mail to external mail service is delivered locally

Follow

Comments

12 comments

  • Avatar
    Keesjan

    You will really like this solution: https://serverfault.com/a/567424 

    Will do for all mailboxes at once...

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Keesjan

    Thank you for the link.

    It may be useful for other Pleskians.

    0
    Comment actions Permalink
  • Avatar
    Geoff Myers

    @Keesjan Thank you for linking to this unofficial solution. It was the only one that actually worked for me.

    0
    Comment actions Permalink
  • Avatar
    Andrea Galizia

    Thank you for the explanation but I am stuck.

    I have several domains, but only one uses an external mail service, let's call it "external.com"

    The mail service is disabled for external.com

    I have checked the postfix configuration and it returns:

         append_dot_mydomain = yes

         mydestination = localhost.$mydomain, localhost, localhost.localdomain

         mydomain = domain.com

    But still, all the emails sent to external.com do not go through.

    Is there something I am missing?

    Thanks in advance for your help.

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Andrea Galizia,

    Have you tried to check the /var/log/maillog file regarding the potential errors?

    If the message is gone to the external mail server but is not delivered to the recipient, it is required to look for the root cause on the external mail server instead of Plesk

    0
    Comment actions Permalink
  • Avatar
    Andrea Galizia

    Hi Nikita,

    yes, and that leads me to the real problem. The emails are bounced back from the external mail server with message "550 Sender domain is a local domain".

    I have noticed that despite the contact form sends with "user@anotherdomain.com" as a sender, Postfix changes it to username@external.com, where username is the subscription user name and external.com is the domain that uses external email server. No matter what I do the sernder is always the same.

    I have moved all the domains from shared hosting with cPanel to VPS with Plesk; only on Plesk this problem happens, on cPanel I have no problems.

    0
    Comment actions Permalink
  • Avatar
    Andrea Galizia

    I think this is my case: https://support.plesk.com/hc/en-us/articles/360002906354-Emails-sent-using-a-PHP-script-use-incorrect-sender-email-address

    But I do not have access to modify WordPress scripts, besides it works fine under cPanel.

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Andrea Galizia,

    Indeed, In Plesk emails via PHP are sent under the system user

    However, possibly this article could help you:

    How to send mail via PHP script using a mailbox located on another server?

    0
    Comment actions Permalink
  • Avatar
    Andrea Galizia

    Hi @Nikita Nikushkin,

    thanks for the solution but the domain uses WordPress, not easy to change the library used for sending emails. Temporarily I have solved by sending the email to a mailbox on another domain hosted on the same server, and the mailbox forward to the external mail server.

    Not an elegant solution but it works.

    Giving the possibility to choose the sender on PHP emails will be nice to have in future Plesk versions, it would save so much time and reduce frustration.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Adrea,

    Thank you for the shared solution and detailed feedback.

    Based on your case, I've created a feature-suggestion to add such functionality to Plesk: https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/38144563-ability-to-set-sender-email-address-from-plesk?

    Feel free to vote for it and comment. The top-rated suggestions are likely to be implemented in the future product versions.

     

    0
    Comment actions Permalink
  • Avatar
    Jay Cee

    Recently used VPS + Plesk as web- & email-Server. Now switched to MS 365/Exchange mail service for that certain Domain, here: domain.com, web service remains on Plesk. Mailservice in Plesk has to be still active for domain.com while used as a backup mailserver / archive clients need to be able to connect to.

    The Problem: Other domains (here: domain-2.com etc) on that VPS/Plesk setup still use the Plesk mail service for email delivery. While there are several email forwardings set up for domain-2.com to the above mentioned domain.com those mails are forwarded and delivered locally, not to MS 365/Exchange's mailservice.

    In short:

    Mails to domain-2.com (with Plesk mail service active and in use) have to be delivered to domain.com (also with Plesk mail service active and in use) with an external mail service running.

    How is this achieved? 

    Thank you!

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov (Edited )

    Hi Jay,


    It is not possible. Postfix designed in a way that if the domain is located on local server it will always deliver locally and will never check for MX records, means it will never attempt to send externally.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request