Force SMTP to send outside server

Discussion in 'ISPConfig 3 Priority Support' started by Molive, Feb 12, 2025.

  1. Molive

    Molive New Member HowtoForge Supporter

    Hello,

    I would like to use an mail account in my ISPconfig to only send mails from an external application while emails for this domain are managed by another server (MX record).

    Problem: when I send an email to a recipient in the same domain, Postfix tries to deliver it locally.

    How can I do to force it to send emails outside my server, even if the recipient domain is declared in ISPconfig?

    Thanks in advance.

    Molive
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do not declare the recipient domain in ISPConfig. If a domain is a local email domain on your server, the server will catch all emails for that domain.
     
  3. Molive

    Molive New Member HowtoForge Supporter

    Thank you but I think my description wasn't clear enough.

    Maybe with an example of what I want to do :
    - mydomain.com emails are managed by Microsoft.
    - But I want to configure My ISPconfig to send emails with [email protected] as sender for an application which cannot use Microsoft SMTP (because of their MFA)
    - It works when I send emails to recipients outside mydomain.com, but if I send to [email protected] ISPconfig server thinks it has to deliver it locally and obviously doesn't find the corresponding account

    I understand it's a normal behavior, but is there a way to bypass it?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I understand your first question, and my suggestion was based on that. As I mentioned, when you configure a domain as local domain, then postfix will catch all emails for it. Therefore my suggestion to remove it from local domains and use another domain for sending and smtp authentication. Here is a more in-depth answer from ChatGPT:

    When you add a email domain in ISPConfig, it gets added to virtual_mailbox_domains, therefore postfix must catch the emails. Solution 2 does not apply to your problem, as you can't send then.
    Solution 3 (via chatgpt):

    It is not a solution for your case as you won't be able to send them either. And just a general note, instead of editing transports file, you would use transports settings in ISPConfig. But as mentioned, this suggestion does not solve your problem as well.

    Therefore, remove that domain and send trough another domain, e.g. a subdomain. So instead of adding e.g. yourdomain.tld in postfix, add smtp.yourdomain.tld in postfix and use that for sending. This way, you can send to yourdomain.tld as the email domain of this server is smtp.yourdomain.tld.
     
  5. Molive

    Molive New Member HowtoForge Supporter

    Thank you Till,
    I'll use a subddomain, it's pretty much simpler.
    Thank you for your suggestions
     

Share This Page