LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 05-28-2004, 12:13 AM   #1
abapdr
LQ Newbie
 
Registered: May 2004
Posts: 10

Rep: Reputation: 0
Question Postfix - cannot send e-mail


Hi Gurus,

Background: Mandrake 10.0 Community
I have setup DNS, a webserver and postfix on my Linux box, no local network just yet. I have 2 static IPs: aa.bb.cc.01 and aa.bb.cc.02.
Using this very Linux box where the servers are I CAN receive e-mail from the internet and I CAN send e-mail to any other alias inside my domain. However, I CAN NOT send e-mail to the internet. Here are the relevant details:

hostname: mydomain.com

/etc/hosts
aa.bb.cc.01 mydomain.com mydomain
aa.bb.cc.02 mydomain.com mydomain
127.0.0.1 localhost

DNS entries: (db.mydomain.com)
mydomain.com IN MX 10 mail.mydomain.com
www_mydomain.com IN A aa.bb.cc.01
mail.mydomain.com IN A aa.bb.cc.02

/etc/postfix/main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www_$mydomain, ftp.$mydomain
mynetworks_style = host
mynetworks = 192.168.1.0/24, 127.0.0.0/8, 10.0.0.0/8
relay_domains =
relayhost = mail.isp.net

The error message from my log file:
postfix/smtpd[2722]: connect from mydomain.com[aa.bb.cc.02]
postfix/smtpd[2722]: NOQUEUE: reject: RCPT from mydomain.com[aa.bb.cc.02]: 554 <test@domain.com>: Relay access denied; from=<from@mydomain.com> to=<test@domain.com> proto=ESMTP helo=<mydomain.com>
postfix/smtpd[2722]: disconnect from mydomain.com[aa.bb.cc.02]

What am I doing wrong here? Under relayhost I tried mail.mydomain.com as well, no luck.
Any help would be much appreciated!
abapdr
 
Old 05-28-2004, 03:01 AM   #2
Jonasx
Member
 
Registered: Sep 2003
Location: In the network closet
Distribution: Gentoo
Posts: 37

Rep: Reputation: 15
Is the hostname on you machine set correct like <mail.mydomain.com>?

Is you $mydomain var actually set to you domain? maybe try setting it to you actual domain name?

and since you have the networks set maybe set mynetworks_style = host to mynetworks_style = subnet

not that i really see anything wrong with the config...just comparing it to mine and pointing out differrences...:]

Last edited by Jonasx; 05-28-2004 at 03:11 AM.
 
Old 05-28-2004, 02:51 PM   #3
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
You will probably need to set a relay host. A lot of ISP's are blocking outgoing traffic on port 25 now and mail can only be sent through their mailserver. A lot of mailservers on the internet are not relaying email from most ISP's blocks of ip addresses as well, so you would be blocked from a lot of people's mailserver without it.


relayhost=
smtp.myispsserver.com


Don't forget to check your log file.

/var/log/maillog

Last edited by DavidPhillips; 05-28-2004 at 02:56 PM.
 
Old 05-29-2004, 12:43 AM   #4
abapdr
LQ Newbie
 
Registered: May 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Question Postfix - cannot send e-mail

Jonasx, David,
Thanks for your input.
- In the /etc/postfix/main.cf file I set myhostname=example.com, because that's the hostname I get back when I type the <hostname> command.
- The actual domain name is the same as the myhostname variable (example.com), so $mydomain=example.com
- Since I explicitly specify the mynetworks entries I believe the mynetworks_style variable is ignored anyway
- My ISP does not block port 25
- I set relayhost=mail.speakeasy.net (I got this from them), still no luck.
This is getting frustrating...
abapdr
 
Old 05-29-2004, 02:40 AM   #5
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
We need to verify the connection.

Try to connect to a mailserver using telnet like this.

First get the MX record for the mailserver, if your trying to send mail to username@hotmail.com you would do this..

Code:
[david@slacker david]$ dig MX hotmail.com
 
; <<>> DiG 9.2.2-P3 <<>> MX hotmail.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32888
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 4, ADDITIONAL: 20
 
;; QUESTION SECTION:
;hotmail.com.                   IN      MX
 
;; ANSWER SECTION:
hotmail.com.            3506    IN      MX      5 mx2.hotmail.com.
hotmail.com.            3506    IN      MX      5 mx3.hotmail.com.
hotmail.com.            3506    IN      MX      5 mx4.hotmail.com.
hotmail.com.            3506    IN      MX      5 mx1.hotmail.com.
The answer section shows the mailservers.

Now telnet into one of the mailservers..

Code:
[david@slacker david]$ telnet mx2.hotmail.com 25
Here is what you should see..

Code:
Trying 65.54.252.230...
Connected to mx2.hotmail.com.
Escape character is '^]'.
220 mc6-f34.hotmail.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.6713 ready at  Fri, 28 May 2004 23:27:56 -0700
You need to send an ehlo..

Code:
ehlo mail.dcphillips.net
Now you should get a greeting..

Code:
250-mc6-f34.hotmail.com (02.04.01.0013) Hello [68.63.76.175]
250-SIZE 29696000
250-PIPELINING
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-AUTH LOGIN
250-AUTH=LOGIN
250-X-HMAUTH
250 OK
enter your mail from info like this..

Code:
 

mail from: david@dcphillips.net
The server will reply..

Code:
250 david@dcphillips.net....Sender OK
Then the recipient info..

Now enter the data command..

Code:
data
You should get a response..

Code:
354 Start mail input; end with <CRLF>.<CRLF>
Enter your message, end with a period on a line by itself..

Code:
 Hello, this is only a test.
 
.
You should get something like this..

Code:
250 <MC6-F34A5zz0OWlZr0Q00093a81@mc6-f34.hotmail.com> Queued mail for delivery
Type quit to exit server..


Code:
 

quit
221 mc6-f34.hotmail.com Service closing transmission channel
Connection closed by foreign host.


If that works your connection should be ok. You should then try to relay mail through your isp's server by the same method.
 
Old 05-29-2004, 03:47 AM   #6
abapdr
LQ Newbie
 
Registered: May 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Postfix - cannot send e-mail

David,
Thank you very much for your reply!

I assume when I do ehlo I provide my mail server, right? mail.example.com is my MX 10 entry in my DNS server config.
I was trying to follow your instructions, everything is OK. (I hope doodlebuggerr@hotmail.com is not going to be too angry...)
I tried the same with my ISP (where I have an account) and I could successfully send an email from abapdr@example.com to abapdr@myisp.com, no problem.

Now I tried with yahoo where most of my buddies are, but I got stuck.

Here is how far I've got:

[abapdr@example abapdr]# dig mx yahoo.com

; <<>> DiG 9.2.3 <<>> mx yahoo.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6940
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;yahoo.com. IN MX

;; ANSWER SECTION:
yahoo.com. 7169 IN MX 1 mx1.mail.yahoo.com.
yahoo.com. 7169 IN MX 1 mx2.mail.yahoo.com.
yahoo.com. 7169 IN MX 5 mx4.mail.yahoo.com.

;; Query time: 28 msec
;; SERVER: 64.81.79.2#53(64.81.79.2)
;; WHEN: Sat May 29 00:08:26 2004
;; MSG SIZE rcvd: 92

[abapdr@example abapdr]# telnet mx1.mail.yahoo.com 25

Trying 64.157.4.78...
telnet: connect to address 64.157.4.78: Connection refused
Trying 64.156.215.5...
Connected to mx1.mail.yahoo.com (64.156.215.5).
Escape character is '^]'.
220 YSmtp mta108.mail.scd.yahoo.com ESMTP service ready

ehlo mail.example.com

250-mta108.mail.scd.yahoo.com
250-8BITMIME
250-SIZE 10485760
250 PIPELINING

mail from: abapdr@example.com

501 Syntax error in parameters or arguments

This is it. After a short while it times out.
451 Timeout
Connection closed by foreign host.

So what does this mean? I can send e-mail to certain people but not to others?
abapdr
 
Old 05-29-2004, 11:47 AM   #7
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
That's correct. If you login to yahoo's mail server it disconnects as soon as it sends the 250.

If you hit enter you will be out of the login. You can send mail to a yahoo user through the relay host for your isp. You should probably test it. Everything is the same as if you were on yahoo's server except you connect to your relay server. AOL will probably not work either.


[david@slacker david]$ telnet mailin-01.mx.aol.com 25
Trying 205.188.159.57...
Connected to mailin-01.mx.aol.com.
Escape character is '^]'.
554- (RTR:BB) The IP address you are using to connect to AOL is a dynamic
554- (residential) IP address. AOL will not accept future e-mail transactions
554- from this IP address until your ISP removes this IP address from its list
554- of dynamic (residential) IP addresses. For additional information,
554- please visit http://postmaster.info.aol.com.



I think if you can relay mail to yahoo or aol through your isp mailserver you should be ok.


You should probably test that using telnet to see if it works.

Last edited by DavidPhillips; 05-29-2004 at 11:50 AM.
 
Old 05-29-2004, 11:52 AM   #8
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
When you are trying to send mail through your mailserver that gets relay denied are you on that machine or on another machine on your network?


relay domains are who you are relaying for..

Code:
relay_domains =
    $mydestination
also you may want some restrictions..
Code:
smtpd_client_restrictions =
    permit_mynetworks,
    reject_unknown_client,
    reject_invalid_hostname,
    reject_non_fqdn_sender,
    reject_non_fqdn_recipient,
    reject_unknown_sender_domain,
    reject_unknown_recipient_domain,
    reject_unauth_pipelining,
    reject_unauth_destination,
    reject_maps_rbl,
    permit
which would also require my_networks to be defined..
Code:
mynetworks =
    192.168.0.0/24,
    192.168.1.0/24,
    127.0.0.0/8



Last edited by DavidPhillips; 05-29-2004 at 11:57 AM.
 
Old 05-29-2004, 02:54 PM   #9
abapdr
LQ Newbie
 
Registered: May 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Lightbulb Postfix - cannot send e-mail - SOLVED

David,

Thank you so much for following up on this issue. You would not believe what the problem was!

I started to get suspicious of the fact that using my mail client wherever I tried to send an e-mail (except for within my own domain) I got the very same "Relay access denied" message. Checked the log, and as I showed it in my original e-mail I saw the following:

postfix/smtpd[2722]: connect from example.com[aa.bb.cc.02]
postfix/smtpd[2722]: NOQUEUE: reject: RCPT from example.com[aa.bb.cc.02]: 554 <buddy@domain.com>: Relay access denied; from=<abapdr@example.com> to=<buddy@domain.com> proto=ESMTP helo=<example.com>
postfix/smtpd[2722]: disconnect from example.com[aa.bb.cc.02]

At the same time the mynetworks setting is
mynetworks = 192.168.1.0/24, 127.0.0.0/8, 10.0.0.0/8

I'm trying to send an e-mail from the server where my mailserver is running but the log does not show the localhost as the sender, it shows the IP address of my mailserver (aa.bb.cc.02). My own mailserver denied relay access from me!!!??? Sounds strange? I thought so!

I changed the mynetworks setting to
mynetworks = 192.168.1.0/24, 127.0.0.0/8, 10.0.0.0/8, aa.bb.cc.02
and now it works, I can send e-mail to anybody even to my yahoo buddies. I do not even have to relay through my isp's mail server, I have the relay_host commented out in my config file:
#relayhost =

Thanks so much for your time and contribution! Now I can attend to my other problems!
abapdr

Last edited by abapdr; 05-29-2004 at 02:56 PM.
 
Old 05-29-2004, 04:38 PM   #10
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
Cool,

AOL is one of the main ones that are blocking dynamic addresses. If you never use them you might be ok for most mail. You should get an email if any letter is denied.
 
Old 04-17-2006, 02:31 PM   #11
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Rep: Reputation: 15
i would like to re-open this post lol..i have followed everything on here and still no luck with postfix sending to anywhere except my own domain. i have used telnet and i connect and everything works but i still have no luck sending...my domain is 3gxlive.com
 
Old 04-17-2006, 03:39 PM   #12
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
postconf -n is always a good way to start a "I need help with my Postfix Mail Server" type post Might have been a good idea to start a new thread for your problem as well so as not to confuse people..

postconf -n will print out all the items that are NOT default in your postfix configuration. makes it easy to see all the changes you have made. (this is also the first thing that is asked for on the Postfix mail list)

Also did you test using a relayhost as mentioned above ? a LOT of ISP's block mail servers on dynamic or residential service.

Last edited by farslayer; 04-17-2006 at 03:40 PM.
 
Old 04-17-2006, 06:04 PM   #13
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Rep: Reputation: 15
sorry..i just thought i would get critisized if i started a new one..other forums usually have problems with starting a new topic when there is one already made... postconf -n gave this results (NOTE: i am using vhcs which may change settings http://vhcs.net)

Code:
alias_database = hash:/etc/aliases
append_at_myorigin = yes
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
inet_interfaces = all
local_destination_recipient_limit = 1
local_recipient_maps = unix:passwd.byname $alias_database
local_transport = local
mail_spool_directory = /var/spool/mail
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = $myhostname, $mydomain
mydomain = 3gxlive.com
myhostname = ns.3gxlive.com
mynetworks = 68.118.210.0/24, 127.0.0.0/8
mynetworks_style = host
myorigin = $mydomain
setgid_group = postdrop
smtpd_banner = $myhostname VHCS2 2.4 (Spartacus) Managed ESMTP 2.4.7.1
smtpd_recipient_restrictions = permit_sasl_authenticated,   permit_mynetworks,   reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = vhcs.net
smtpd_sasl_security_options = noanonymous
transport_maps = hash:/etc/postfix/vhcs2/transport
virtual_alias_maps = hash:/etc/postfix/vhcs2/aliases
virtual_gid_maps = static:8
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_domains = hash:/etc/postfix/vhcs2/domains
virtual_mailbox_limit = 0
virtual_mailbox_maps = hash:/etc/postfix/vhcs2/mailboxes
virtual_minimum_uid = 107
virtual_transport = virtual
virtual_uid_maps = static:107
and also in master.cf i attempted to change the following line from:

Code:
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
to

Code:
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
as it was posted in the vhcs forums..and it did not work

i did notice that while i did: telnet mail.3gxlive.com 25 and sent an email to user@hotmail.com it went successfuly

also, if u need think dns problems could be apparent my dns is setup correctly as well
http://www.dnsreport.com/tools/dnsre...in=3gxlive.com

Last edited by ballistic509; 04-17-2006 at 09:57 PM.
 
Old 08-13-2013, 06:47 AM   #14
vasudevan.vinod
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
Postfix sending mails to mailbox but mails are not received

I am facing an issue with postfix. I have configured Postfix SMTP, saslauthd and dovecot. I also have a smtp replay which is lets say a.b.c.d over port 25. Now when I use telnet to send email using postfix can see no errors in log file (dsn=2.0.0, status=sent (delivered to mailbox)). However, I dont get the mail in the inbox. I have also added the relay server as well but still no mails. When do telnet on the relay box I am able to get the mail in my Inbox. Please can you help me with this issue?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
not able to send mail using postfix Robin01 Linux - Software 4 12-28-2007 04:41 PM
Postfix send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 4 07-11-2005 10:12 PM
Postfix able to send but not receive mail :( !! Ikik Linux - General 10 01-28-2004 08:40 PM
Postfix will not send mail antken Linux - Networking 1 10-05-2003 07:28 PM
what does postfix use to send mail? ShawnD Linux - Software 0 08-31-2002 05:21 AM


All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration