server3 postfix/trivial-rewrite[15407]: warning: hash:/etc/postfix/relayhost_map lookup error for ""

I am getting an error when testing sendgrid in command shell…

server3 postfix/trivial-rewrite[15407]: warning: hash:/etc/postfix/relayhost_map lookup error for “”
server3 postfix/trivial-rewrite[15407]: warning: sender_dependent_relayhost_maps lookup failure
server3 postfix/error[17434]: B62708488F:, relay=none, delay=0.24, delays=0.2/0.02/0/0.02, dsn=4.3.0, status=deferred (address resolver failure)

Now if i look at this and try to apply some logic to it, i believe that the problem is there is no relayhost_map for my

The thing is, is the relay map missing for the server, or for the user? I seem to get the same error no matter which user i am testing with (i have tried 3 of them that are active)

So in virtualmin, how do i create a relayhost_map and what information is needed in such a map?

I have tried to perform the test email via sendgrid using both my root and google cloud users…both result in the same error (with different usernames obvously).

see my /etc/postfix/ below…

# See /usr/share/postfix/ for a commented, more complete version

Debian specific: Specifying a file name will cause the first

line of that file to be used as the name. The Debian default

is /etc/mailname.

#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

appending .domain is the MUA’s job.

append_dot_mydomain = no

Uncomment the next line to generate “delayed mail” warnings

#delay_warning_time = 4h

readme_directory = no

See – default to 2 on

fresh installs.

compatibility_level = 2

TLS parameters

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for

information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname,,, , localhost
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
allow_percent_hack = no
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map
smtp_sender_dependent_authentication = yes
relayhost = []:2525
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous

Does the file /etc/postfix/relayhost_map exist? And, does it have that user in it?

It’s been a while since I setup a relayhost map. But, I don’t know that you need a relayhost_map, if you’ve got a relayhost. relayhost_map would allow you to choose how to relay based on the sender…but, relayhost tells me you’re sending everything viaa sendgrid.

Based on their instructions here, that’s all you need, since it looks like you did the sasl_passwd already:

Obviously port needs to be 2525, as you’ve done, because Google.

So, why the sender_dependent_relayhost_maps?

Hi Joe,
thank you for your reply, I have checked my filesystem in webmin filemanager. There is no /etc/postfix/relayhost_map file in it.

So, why the sender_dependent_relayhost_maps? i have no idea, thats the error i am getting. I have followed the tutorial exactly as outlined in google cloud compute and this is what happens.

EDIT…ah i have found the problem.

What i did not find in the tutorials is that one must ensure the following line in /etc/postfix/ is either deleted or commented out as shown.

#sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map

As soon as i read your comment Joe, the penny started to drop and i went looking for it an voila there it was. Bloody incomplete tutorials on google cloud and sendgrid!!!

Thanks Joe, it appears that my test email sent via command shell to three email addresses has now gone through. hopefully that means it is working.