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? |
Could you post the output of the following command
Code:
postconf -n |
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 |
Run these two commands
Code:
postconf -e "myorigin = mydomain.com" Code:
postfix reload |
|
How are you submitting your mail?
|
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. |
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% |
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
|
Quote:
/etc/hosts: Besides the default localhost, you should also have your host. Code:
192.168.0.x mail.example.com mail Code:
mail.example.com /etc/postfix/main.cf: Code:
myhostname = mail.example.com GANI |
|
using -f flag only changes the envelope, not the header btw
What distro are you using? |
Thanks for the suggestions I'll give them a try and let you know how it works out
|
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 |
what is the output of the hostname command?
|
The output is durhamnetwork.sytes.net. The same domain that shows up when that denyhosts tool send me the notice.
|
Can you please send an email externally and post the relevant entries in maillog?
The problem may not be on your server at all, it may be the relay that you're sending through. Hopefully the log will shed some light on it. |
Thanks for sending through your logs (for anyone reading, taigon emailed me through the forum).
it certainly looks to me from the log that all is working fine, and I note in the following link http://www.hawkwings.net/2006/12/22/...rt-587-is-for/ that is says Quote:
|
Well, I will take a look at the gmail settings but I don't think that is the issue because as I mentioned, the tool that is running on my server to block intruders, sends me an email every ip that is blocked. The address that shows from where it was sent from contains the denyhosts@durhamnetwork.sytes.net address and it is indeed sending it through the gmail smtp server as well. So that doesn't mean that it is the gmail settings.
|
So are you saying that denyhosts is sending an email from your server through gmail and to your email on a different machine?
If it's only for local delivery, postfix won't send the email through gmail |
Is there any way to re-write the header when postfix is sending mail so the the reply to from: address is the localuser@durhamnetwork.sytes.net instead of the gmail email address? This has to be how the tool on my server is sending messages.
|
Is denyhosts sending the messages to a remote machine?
|
No, it is sending it through gmail because every message that gets sent through gmail seems to show a copy of the message in gmails inbox.
What I just realized though is the name of the sender shows Deny Hosts but the reply address is showing the gmail account address. So this isn't helping me anyway. Sorry for wasting your time:P Do you know of a different free host that can be used for smtp that doesn't change the name of the domain? |
Can't you use your ISP's?
|
I've tried that and also yahoo but it rejects the sender because it isn't from their domain.
|
You ISP doesn't provide an SMTP server for your use?
|
Yes they do have one for me to use but the server rejects the FROM: email address as it is not from the ISP's domain. Meaning, if I try to send from root@durhamnetwork.sytes.net the server will indicate that it is not a valid account. The originating email must come from whatever@sympatico.ca.
I would need an SMTP server to relay through that does not have any restrictions like that. |
I see. Does you ISP block port 25? If not, why not send directly
|
Yes, my ISP blocks outgoing port 25. I'm trying to figure out how to get this port forwarding tool I just installed to forward any outgoing mail from port 25 to port 587 instead. They havn't blocked that. By default postfix will only send directly through port 25. Wish I knew how to change that.
|
Maybe you can help me with this one the, I have a shell account that has an open outbound mail server and submission port 587 open. I've configured sasl authentication to connect but it keeps rejecting the relay do to authentication. I telnet'd into the account and then telnet'd to the local host on port 587 and I was able to send myself an email using the standard SMTP commands. The email I received did come from root@durhamnetwork.sytes.net. It sent it no problem. For some reason when I try to telnet to the same port on this other server from my local machine, it won't let me authenticate after I start with "HELO". If I start with "EHLO durhamnetwork.sytes.net", it accepts the domain and lets me continue. Problem is that I don't know how to get the encrypted user name and password to authenticate afterwards, so I don't know how it is trying to authenticate at this point.
Feb 8 03:09:25 durhamnetwork postfix/master[11645]: daemon started -- version 2.3.3, configuration /etc/postfix Feb 8 03:10:23 durhamnetwork postfix/smtpd[11654]: connect from localhost[127.0.0.1] Feb 8 03:10:23 durhamnetwork postfix/smtpd[11654]: 54C605E018F: client=localhost[127.0.0.1] Feb 8 03:10:23 durhamnetwork postfix/smtpd[11654]: disconnect from localhost[127.0.0.1] Feb 8 03:10:23 durhamnetwork postfix/pickup[11647]: 5EF285E0191: uid=100 from=<taigon@durhamnetwork.sytes.net> Feb 8 03:10:23 durhamnetwork postfix/cleanup[11656]: 5EF285E0191: message-id=<Pine.LNX.4.64.0702080310140.11651@durhamnetwork.sytes.net> Feb 8 03:10:23 durhamnetwork postfix/qmgr[11648]: 5EF285E0191: from=<taigon@durhamnetwork.sytes.net>, size=591, nrcpt=1 (queue active) Feb 8 03:10:23 durhamnetwork postfix/smtp[11658]: 5EF285E0191: to=<taigon1984@hotmail.com>, relay=trifocus.net[66.25.148.34]:587, delay=0.45, delays=0.07/0.03/0.35/0, dsn=5.7.0, status=bounced (SASL authentication failed; server trifocus.net[66.25.148.34] said: 535 5.7.0 authentication failed) Feb 8 03:10:23 durhamnetwork postfix/cleanup[11656]: CB9C95E0192: message-id=<20070208081023.CB9C95E0192@durhamnetwork.sytes.net> Feb 8 03:10:23 durhamnetwork postfix/qmgr[11648]: CB9C95E0192: from=<>, size=2554, nrcpt=1 (queue active) Feb 8 03:10:23 durhamnetwork postfix/bounce[11660]: 5EF285E0191: sender non-delivery notification: CB9C95E0192 Feb 8 03:10:23 durhamnetwork postfix/qmgr[11648]: 5EF285E0191: removed Feb 8 03:10:23 durhamnetwork postfix/local[11661]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Feb 8 03:10:23 durhamnetwork postfix/local[11661]: CB9C95E0192: to=<taigon@durhamnetwork.sytes.net>, relay=local, delay=0.04, delays=0.01/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail) Feb 8 03:10:23 durhamnetwork postfix/qmgr[11648]: CB9C95E0192: removed |
Can't you just forward using iptables - here's the equivalent for squid
Quote:
ps - have you asked your ISP if they will open port 25? |
|
I just tried the same mail server again using TLS but I get these errors:
Feb 8 22:24:16 durhamnetwork postfix/cleanup[3240]: 389505E0191: message-id=<Pine.LNX.4.64.0702082224090.3235@durhamnetwork.sytes.net> Feb 8 22:24:16 durhamnetwork postfix/qmgr[3233]: 389505E0191: from=<root@durhamnetwork.sytes.net>, size=592, nrcpt=1 (queue active) Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: setting up TLS connection to trifocus.net Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: certificate verification failed for trifocus.net: num=18:self signed certificate Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: certificate verification failed for trifocus.net: num=10:certificate has expired Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: certificate verification failed for trifocus.net:certificate has expired Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: certificate verification failed for trifocus.net:certificate has expired Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: Unverified: subject_CN=smurfette.meathouse.trifocus.net, issuer=smurfette.meathouse.trifocus.net Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: TLS connection established to trifocus.net: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits) Feb 8 22:24:17 durhamnetwork postfix/smtp[3242]: 389505E0191: to=<taigon1984@hotmail.com>, relay=trifocus.net[66.25.148.34]:587, delay=1.3, delays=0.09/0.08/1.1/0, dsn=5.7.0, status=bounced (SASL authentication failed; server trifocus.net[66.25.148.34] said: 535 5.7.0 authentication failed) What does it mean that my certificate has expired? I just created that certificate not long ago. |
Guess what!! I got my isp's mail server to finally work!
Feb 8 22:47:56 durhamnetwork postfix/postfix-script: starting the Postfix mail system Feb 8 22:47:56 durhamnetwork postfix/master[3491]: daemon started -- version 2.3.3, configuration /etc/postfix Feb 8 22:51:01 durhamnetwork postfix/smtpd[3501]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Feb 8 22:51:01 durhamnetwork postfix/smtpd[3501]: connect from localhost[127.0.0.1] Feb 8 22:51:01 durhamnetwork postfix/smtpd[3501]: 99B575E018F: client=localhost[127.0.0.1] Feb 8 22:51:01 durhamnetwork postfix/pickup[3492]: 9F3EC5E0191: uid=0 from=<root@durhamnetwork.sytes.net> Feb 8 22:51:01 durhamnetwork postfix/cleanup[3504]: 9F3EC5E0191: message-id=<Pine.LNX.4.64.0702082250550.3500@durhamnetwork.sytes.net> Feb 8 22:51:01 durhamnetwork postfix/smtpd[3501]: disconnect from localhost[127.0.0.1] Feb 8 22:51:01 durhamnetwork postfix/qmgr[3493]: 9F3EC5E0191: from=<root@durhamnetwork.sytes.net>, size=592, nrcpt=1 (queue active) Feb 8 22:51:02 durhamnetwork postfix/smtp[3506]: setting up TLS connection to smtphm.sympatico.ca Feb 8 22:51:02 durhamnetwork postfix/smtp[3506]: Verified: subject_CN=smtphm.sympatico.ca, issuer=Entrust.net Secure Server Certification Authority Feb 8 22:51:02 durhamnetwork postfix/smtp[3506]: TLS connection established to smtphm.sympatico.ca: TLSv1 with cipher RC4-MD5 (128/128 bits) Feb 8 22:51:03 durhamnetwork postfix/smtp[3506]: 9F3EC5E0191: to=<taigon1984@hotmail.com>, relay=smtphm.sympatico.ca[65.54.191.190]:25, delay=1.7, delays=0.05/0.09/1.1/0.47, dsn=2.6.0, status=sent (250 2.6.0 <Pine.LNX.4.64.0702082250550.3500@durhamnetwork.sytes.net> Queued mail for delivery) Feb 8 22:51:03 durhamnetwork postfix/qmgr[3493]: 9F3EC5E0191: removed Message was delivered from root@durhamnetwork.sytes.net. Issue resolved for now:P hehe |
That's good news
|
All times are GMT -5. The time now is 12:03 AM. |