0

I'm trying to set my company server up to be able to receive emails to a certain account on a subdomain of our main domain i.e.: linuxuser@subdomain.domain.com

Those incoming mailers should trigger a php script that will handle some content processing.

I'm running Ubuntu Server 20.0.4, Postfix is installed, Dovecot is installed, I also tried using courier so that's there too, but I couldn't get that going

I've gotten this far:

  • I created a linux user and configured postfix to use local accounts as valid mailboxes
  • I configured postfix to accept incoming mail at subdomain.domain.com
  • I added the A and MX records for the subdomain to properly route in google domains
  • I configured SSL on the subdomain (confirmed working properly in ssllabs and through apache when navigating to said subdomain)
  • I added some additional configuration to /etc/postfix/master.cf for triggering the php script (right now just a test script/placeholder):
    smtp      inet  n       -       -       -       -       smtpd
        -o content_filter=myhook:dummy
    ...
    # PHP SCRIPT HOOK
        myhook unix - n n - - pipe
          flags=F user=www-data argv=/path/to/script/MailParser.php ${sender} ${size} ${recipient}   

The MailParser.php script just triggers a write to a log file saying "Successfully got the incoming mail at timestamp"

If I send a mail through smtper.net with these settings

  • HOST subdomain.domain.com
  • PORT 25
  • Use Secured Connection, checked
  • Email From: test@test.com
  • Email To: user@subdomain.domain.com

It successfully triggers the script to write to the log and I can see the "test" message from smtper.net in the user's system mail, so all seems good there.

If I try to send the mail through a normal email client such as my gmail account however, I get a bounce back undeliverable with error:

550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/?p=NoSuchUser f16si1842833plj.1 - gsmtp

I'm stuck at this point.

ajax1515
  • 57
  • 2
  • 9
  • Getting a Google-specific answer means the mail was sent to Google. I don't think this question is answerable without investigating the fully non-delivery notification / the MX records. – anx Sep 15 '21 at 13:21

1 Answers1

0

The issue turned out to be with the MX records as @anx pointed out. Additionally the SSL Certificate on the domain was not fully configured so that was also causing issues. Otherwise my local server configurations were set up correctly.

ajax1515
  • 57
  • 2
  • 9