Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently, i'm having an out-of-the box settup of postfix on ubuntu (postfix 2.7.1) on server A. When i'm trying to send an email from server B with "telnet serverA 25" from an email address inside my company to my gmail i'm getting a relay not allowed error (wich is correct). So to work around this relay problem I need to add a network to "my_networks" in the postfix configuration file (main.cf). After adding the subnet 10.0.0.0/16 to this configuration, the email from serverB to gmail gets sent.

The problem is when I recieve the email in gmail, it is dropped in "junk" because there is no from and to header in the mail! So in gmail, the mail is from "sender unknown".

When I send an email from serverA with "telnet serverA 25" the "to and from" headers are there in gmail, so it's only when the mail comes from a different server or subnet... Any idea how to fix this?

This is my configuration:

# 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 (Ubuntu)
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

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
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.

myhostname = smtp.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = smtp.domain.com, kwik.intranet, localhost.intranet, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/16
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
share|improve this question
add comment

2 Answers

Do you type the From and To in your telnet transaction ? Postfix should not change this part of the message... It is not the enveloppe, it is the header description. So you need to add a "From: " and a "To: " after your MAIL FROM and RCPT TO commands

share|improve this answer
add comment

When i'm trying to send an email from server B with "telnet serverA 25" from an email address inside my company to my gmail i'm getting a relay not allowed error (wich is correct)

Oh dear.

Do you usually use telnet to send emails?

It's up to the program creating the email to populate the to/from headers as well as the SMTP envelope.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.