0

I have a problem with the email forwarding, more like I do not know how to configure Dovecot to do what I want.

Per my understanding the first look up of mails that dovecot does is look up for local domains. So using CF7 in WordPress, if I put a destination email with a domain that is in CyberPanel then Dovecot does not forward the email and I get an error in the logs as:

Jan 19 11:30:12 vmi324675 postfix/pipe[797491]: 7294A821D3B: to=xxxxx@mydomain.com, relay=dovecot, delay=0.02, delays=0/0/0/0.02, dsn=5.1.1, status=bounced (user unknown)

How do I make, so postfix or dovecot ignores all the local emails and always tries to deliver to the "outside"?

I need this functionality as all my email handling is done in Gsuite, so all I need is the contact forms in the websites.

Also, another issue I have that I do not understand is that continuosly I get this message in the Email logs:

Jan 19 11:35:11 vmi324675 dovecot: imap-login: Aborted login (auth failed, 1 attempts in 2 secs): user=xxxx@mydomain.com, method=PLAIN, rip=xxxxxxx, lip=xxxxxxx, TLS, session=

Where is this IMAP login attempt happening?

Thank you very much.

email

1 Answers1

0

First let's make it clear. Postfix is your MTA - responsible for sending email over the SMTP protocol.

Dovecot is your IMAP/POP3 server - you fetch your email from it. Since you are using Gsuite and you are fetching your email from there, you can disable Dovecot on your web hosting.

"How do I make, so postfix or dovecot ignores all the local emails and always tries to deliver to the "outside"?"

Short answer: Make sure that value of the mydestination parameter in /etc/postfix/main.cf is set to localhost and perhaps the FQDN of your Postfix host: mydestination = localhost, localhost.localdomain, smtp.mydomain.com

As well as that the virtual_alias_domains and virtual_mailbox_domains parameters do not contain domains for which your would like the Postfix not to deliver locally and forward to the external MX.

basekat
  • 456
  • 2
  • 5
  • Hi, in the main.cf here is the line mydestination = localhost, localhost.localdomain The thing is that I have around 7-8 domains, and with 1 of them everything works fine, the email gets relayed, if I send the email from domain1.com to email@domain1.com the user is found, but lets say I send the email from domain2.com to email@domain2.com, then the message I get is, user unknow status bounced. This is all very confusing. – whitenoise40 Feb 22 '21 at 08:02
  • Could you in this case check your virtual configuration? What is the value of virtual_alias_domains and virtual_mailbox_domains ? They should not be configured or set to localhost. More info here: http://www.postfix.org/VIRTUAL_README.html – basekat Feb 22 '21 at 10:45
  • Here are the values in a screenshot, https://prnt.sc/103orou – whitenoise40 Feb 22 '21 at 11:40
  • I have seen the screenshot. According to it, the virtual_mailbox_domains parameter is configured to use mysql db as a source. So you can check in your mysql db which domains are configured. The username, password and database/table name should be in the /etc/postfix/mysql-virtual_domains.cf file. Check the same way also your virtual_alias_domains parameter. Then you should have a good idea which domains Postfix thinks it hosts mail for. Check if domain2.com is also there. – basekat Feb 22 '21 at 13:24
  • Interesting, so I checked the db and yes, there are some domains, not all of them, interestingly the one that works (domain1.com) is not in that database table, the other ones that do not work, ar there. Also I do not have a virtual_alias_domains file. I have mysql-virtual_domains.cf, mysql-virtual_email2email.cf, mysql-virtual_forwardings.cf and mysql-virtual_mailboxes.cf. – whitenoise40 Feb 22 '21 at 14:38
  • @Novaidiei. - yes. SO I guess you have some sort of Web admin GUI via which you administer your hosting. You would have to remove those domains from there. I would appreciate if you accept my original answer. – basekat Feb 22 '21 at 14:47
  • Actually, I have tried sending an email from domain3.com, whis is not in the vitual_domains table, and still does not work.But I have set and email address in the CF7 form in Wordpress, which is domain3.com, and the email address that I wrote to forward email to is in use in domain2.com which is in the table. – whitenoise40 Feb 22 '21 at 14:48
  • The sender domain in this case is not important and it is not relevant to the virtual_domains table. So you have setup the CF7 form to send from user@domain3.com to user@domain2.com and the email bounced? As you have noted, domain2.com is in the virtual_domains table and that is the reason. – basekat Feb 22 '21 at 15:05
  • CF7 is configured to send an email to user@domain2.com (domain2.com is in the table), the website where this form is lets say is domain5.com (it is not in the table). So when the email is sent, it gets to the server, the server does the look up, does not find the user and it bounces. – whitenoise40 Feb 24 '21 at 07:13