LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Why is PostFix sending mail using the email address of the smtp account? (https://www.linuxquestions.org/questions/linux-server-73/why-is-postfix-sending-mail-using-the-email-address-of-the-smtp-account-487887/)

taigon 09-28-2006 11:48 PM

Why is PostFix sending mail using the email address of the smtp account?
 
Hello,

I finally got PostFix up and running using gmails smtp server on port 587 using ssl.

Some of my tools that send me reports seem to be able to change the FROM: address to indicate where the message is coming from but for some reason if I try to send an email from one of the linux accounts directly to an external recipient it litteraly sends the message using accountname@gmail.com instead of linuxaccountname@mydomain.com.

Can someone help me out with this please?

WindowBreaker 09-28-2006 11:53 PM

Could you post the output of the following command
Code:

postconf -n
I suspect the $myorigin setting may be the culprit

taigon 10-02-2006 03:18 PM

Heres the results of postconf -n

command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 1
default_privs = nobody
disable_dns_lookups = yes
html_directory = no
local_destination_concurrency_limit = 2
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailbox_command = /usr/bin/procmail
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.2.8/README_FILES
relayhost = [smtp.gmail.com]:587
sample_directory = /usr/share/doc/postfix-2.2.8/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_enforce_tls = no
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/sslcert/cacert.pem
smtp_tls_loglevel = 1
smtp_use_tls = yes
unknown_local_recipient_reject_code = 550

WindowBreaker 10-02-2006 10:37 PM

Run these two commands
Code:

postconf -e "myorigin = mydomain.com"
Where mydomain.com is what you want outgoing emails to show in the "From:" header.

Code:

postfix reload
Then try sending an outgoing email again, and see if it's fixed.

taigon 10-03-2006 10:45 AM

Nope, still shows up as myname@gmail.com

Is there anything else i can try?

Berhanie 10-03-2006 11:27 AM

How are you submitting your mail?

WindowBreaker 10-03-2006 12:04 PM

There's your answer then - the problem isn't postfix, it's your MUA.

Postfix will add $myorigin to an unqualified address it processes. If the address is already fully-qualified, it will leave it alone - which is what is happening here.

Now the question is, if the address is already fully-qualified by the time it gets to postfix, where is the address being generated?

MUA (mutt, pine, etc) --> Postfix --> Internet SMTP Server

My guess is your MUA.

Try the following command:

sendmail -f sender receiver@somewhere.com < /etc/fstab

This will use Postfix's sendmail command, and should append $myorigin to the unqualified sender address before delivering it.

taigon 10-04-2006 10:02 AM

Ok, well, I don't have sendmail installed but there was something call sendmail.postfix in the /usr/sbin directory. So I ran the following command.

/usr/sbin/sendmail.postfix -f sender me@myhouse.com < /etc/fstab

and i received the message from root(me@gmail.com). It changed the name of the sender but not the email address it came from. So that sorta worked but not 100%

codewrighter 01-09-2007 04:43 PM

So I am having the same problem, I did the sendmail -f sender reciever@somewhere.com and when i got my email it was from sender@localhost.localdomain I can't seem to fix this I would appreciate any and all help. Thanks

gani 01-10-2007 12:27 AM

Quote:

got my email it was from sender@localhost.localdomain I can't seem to fix this I would appreciate any and all help. Thanks
Although I'm not so sure if this could be your issue, I'm still suggesting for to check the following below to make sure that they are setup harmoniously. Here it is assumed that your domain is "example.com" and your host is "mail.example.com".

/etc/hosts:

Besides the default localhost, you should also have your host.

Code:

192.168.0.x      mail.example.com    mail
/etc/hostname or /etc/HOSTNAME:

Code:

mail.example.com
Make sure in you /etc/resolv.conf it has an entry -> "lookup file bind".

/etc/postfix/main.cf:

Code:

myhostname = mail.example.com
mydomain = example.com

myorigin = $mydomain

or

myorigin = $myhostname

--------
GANI

billymayday 01-10-2007 02:33 AM

Maybe this will help

http://www.linuxquestions.org/questi...d.php?t=512651

billymayday 01-10-2007 02:43 AM

using -f flag only changes the envelope, not the header btw

What distro are you using?

codewrighter 01-11-2007 09:27 AM

Thanks for the suggestions I'll give them a try and let you know how it works out

taigon 01-30-2007 10:57 PM

Alright, well, I've tried everything suggested here as well and it doesn't seem to want to work. I know it has got to be something wrong with the configuration. I'm using Fedora Core 5 at this point.

Below is a small snipit from the configuration file of a tool called DenyHosts. This configuration is to pre-define the SMTP parameters for this tool so that when someone gets blocked from my box it will send me an email indicating who was blocked.

When I receive this message in my email it is indeed coming from "DenyHosts <denyhosts@subdomain.domain.net>".

I'm using a subdomain because it is a free domain, hehe, but it works none the less.

I do not know how the binary file is actually executing the sending of this email but I know for a fact that it is using the gmail smtp server because when I log into GMAIL I see a copy of every last one of the emails that this tool sent me in the Inbox as a new message for some reason.


ADMIN_EMAIL = myemailaddy@hotmail.com
#
#######################################################################

#######################################################################
#
SMTP_HOST = localhost
SMTP_PORT = 25
SMTP_FROM = DenyHosts <denyhosts@durhamnetwork.sytes.net>
SMTP_SUBJECT = DenyHosts Report


-Dave

billymayday 02-01-2007 06:38 PM

what is the output of the hostname command?


All times are GMT -5. The time now is 05:29 AM.