I am using postfix configuration that use SMTP relay on Sendgrid service like this:
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_tls_security_level = encrypt header_size_limit = 4096000 relayhost = [smtp.sendgrid.net]:587
And it works fine for all emails that are sent from my domain. But there is another scenario that we use:
Users in my domain can are using email forwarding instead of POP3 to push emails they receive in mydomain.com to their gmail.com accounts. And I don't want those email to go through Sendgrid, but rather to be forwarded directly to gmail.
To summarize - I want emails that have to field set to *@mydomain.com to be sent directly and all other emails to go through SMTP relay on Sendgrid service, but in current configuration they all go through Sendgrid.
Can I configure it to work this way?