The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Send SMTP email using external SMTP server, but PHP's mail() emails using local exim server

Discussion in 'E-mail Discussions' started by VMunich, May 27, 2015.

  1. VMunich

    VMunich Registered

    Joined:
    May 27, 2015
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Boston
    cPanel Access Level:
    DataCenter Provider
    Hello,

    In my testing environment, I successfully made one central cPanel email server, that handles email accounts for 5 other cPanel servers.

    In short, when an account is created in one of these 5 cPanel servers, I modified how DNS is provisioned so that MX and webmail.domain.com records point to my central email server. I also had to change cPanel files so that domain.com/webmail point the visitor to my central email server. The clear downside of this is that, every email account has to be created and managed in my central cPanel email server, while everything else has to be managed on the other respectives cPanel servers.

    After I finished this setup I thought: This could cause me a lot of headaches in the long run.


    I went through all this trouble to avoid one thing: Client's emails not reaching inboxes due to blacklists. These blacklists were caused by mass email sending scripts, only.

    So, I never had an IP blacklisted because one client was abusing their email. Every time, it is because of a compromised website, or even clients themselves installing email marketing software and sending a multitude of emails.


    Anyway, what I want to achieve is:

    How could I make SMTP email (or email that is sent from an actual email account in my server) go one way, and scripts email (mainly email sent using PHP's mail() function) go another way?

    This could be:

    - Send SMTP email through local IP xxx.xxx.xxx.xx1, and mail() email through xxx.xxx.xxx.xx2. This way I can at least have more control over blacklists.

    - Send SMTP email through an SMTP service like Mailgun, Sendgrid etc, and send mail() email through the local exim server.

    Disabling PHP's mail() function is not an option.

    Can you guys help me out?

    Thanks.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Does this not happen by default? If you have email accounts handled on the remote mail server, then local email would not utilize that same remote mail server unless it was configured for SMTP authentication.

    Thank you.
     
  3. VMunich

    VMunich Registered

    Joined:
    May 27, 2015
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Boston
    cPanel Access Level:
    DataCenter Provider
    Hi, thanks for you reply.

    Yes, the problem is:

    If I want to change an user's email password, I have to login in the cPanel email server. However if I want to change some files of their website, I have to login on the actual cPanel server where their site is hosted. With many servers, this could cause me some trouble, as this isn't how cPanel is supposed to work by design.

    I think that, if I could handle this in EXIM itself, I could have all email accounts and websites hosted on the same server, as it is supposed to be, but then if EXIM could handle my users emails to an external SMTP server, and handle all email generated by scripts to the local EXIM server, I would have a lot of less headaches regarding my customers' emails not reaching inboxes due to a blacklist caused by spamming scripts.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Have you considered setting up a smart host?

    Smart Host Support

    This option allows you to use a smart host for outgoing messages, rather than modifying the MX records.

    Thank you.
     
Loading...

Share This Page