ncsuapex SpaceForRent 37776 Posts user info edit post |
I'm trying to send emails from my linux PC to an internet address(yahoo,hotmail/etc)
I'm not having much luck with the commands and I'm sure I need to configure sendmail/mta or something. But searching around the internet has confused me to no end.
I've tried(from the commands line, replaced "email" with a valid email) mail email@yahoo.com mail email@hotmail.com
comes back with Subject: I put in a subject
type my message . on a blank line comes back to EOT
tried /bin/mail -s test email@yahoo.com
nail -s testnail -r email@yahoo.com nail -s testnail -r -a filename email@yahoo.com nail email@yahoo.com
So what do I need to do? Mainly just want to send myself emails when my server gets sick. 3/9/2008 9:14:53 PM |
evan All American 27701 Posts user info edit post |
look at the sendmail logs. they will tell all. 3/9/2008 9:17:12 PM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
I've used something similar to http://gentoo-wiki.com/HOWTO_Send_emails_with_shell_scripts to do this kind of thing in the past. 3/9/2008 9:24:25 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
Thanks. I might have to put this off till tomorrow. I'm starting to fade... 3/9/2008 9:59:32 PM |
b_rimes All American 2072 Posts user info edit post |
Try mailx ? 3/9/2008 10:01:00 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
^ is that the same thing as "nail" ? If so I've tried that with no success...
Oh Im running slackware on one PC and Centos 5 on another.
edit: for my reference when I decide to work on this tomorrow. http://www.slackbasics.org/html/sendmail.html
[Edited on March 9, 2008 at 10:26 PM. Reason : .] 3/9/2008 10:15:20 PM |
evan All American 27701 Posts user info edit post |
the easiest/best-way-to-ensure-your-email-doesnt-get-filtered-out-by-spam-filters is to set up sendmail to use a smart host so your machine isn't actively an MTA communicating with other servers, but you get an ISP or something of that sort to act as an intermediary.
most spam filters are set to automatically reject messages originating from an MTA hosted on an IP that ARIN considers to be dynamically allocated. 3/9/2008 11:35:07 PM |
mellocj All American 1872 Posts user info edit post |
^ ARIN does not classify IPs as being dynamically allocated or not. That is up to the service provider. Many mail admins block mail that comes from an IP with reverse DNS of a-b-c-d.blahblah where a.b.c.d is the IP address. There are also blacklists with lots of common dynamic IP ranges, such as the Spamhaus PBL.
The problem could also be that your linux box is trying to deliver directly to a recipient mail server and your system's hostname is set wrong or the from address is @localhost.localdomain. Using a Smarthost would be a good idea if you don't have a static IP and control of your reverse DNS.
Run 'tail -n 30 /var/log/maillog' after you try to send a test message and paste it here. 3/10/2008 7:27:50 AM |
Stein All American 19842 Posts user info edit post |
I was running into a problem like you guys had been describing (DNS was set up wrong, leading to a host of 'not a valid domain' type e-mails). It's straightforward enough to fix with a proper MX record, you just need to know it's the issue.
Sendmail logs are definitely the thing to go look at. Is this a server you're hosting on your ISP or a site you're hosting at a hosting company/datacenter? 3/10/2008 7:53:35 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
Quote : | "The problem could also be that your linux box is trying to deliver directly to a recipient mail server and your system's hostname is set wrong or the from address is @localhost.localdomain" |
Im pretty sure that's the problem on my centos 5 box. It's only on my network and doesn't have a real hostname.
On my Slackware box I have a hostname and I have a script that checks dyndns.org every 15 minutes to ensure my IP hasn't change and changes it if it needs to.
Quote : | "Is this a server you're hosting on your ISP or a site you're hosting at a hosting company/datacenter?" |
hosted on my slackware box at home.3/10/2008 8:35:58 AM |
Stein All American 19842 Posts user info edit post |
Quote : | "On my Slackware box I have a hostname and I have a script that checks dyndns.org every 15 minutes to ensure my IP hasn't change and changes it if it needs to." |
Make sure you have an A record for "mail" and that it points to your server's IP address, then make sure you have an MX record for @ that points to mail.domain.com. (extra period is important). I guess you could just have the MX record @ point to domain.com. but I don't know enough about DNS configurations to know if that's a terrible idea.
Then configure your server's sendmail to use the mail.domain.com as the SMART_HOST. Realistically you could have both domains do this; should start working after that.
[Edited on March 10, 2008 at 9:01 AM. Reason : At least this is what I had to do to get mine working. I might be wrong though]3/10/2008 8:59:19 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
hmmm this is turning into more than I expected... All I wanted to do was send an email from my linux PC to my internet mail!!! lol
Set this up on zoneedit.com
IP Addresses: Domain Name IP Address myhostname.us 0.0.0.0 mail.myhostname.us 0.0.0.0 http://www.myhostname.us 0.0.0.0 Mail Servers: Domain Server Rank myhostname.us mail.myhostname.us 0
*changed the hostname and IP to generic names.
now.. I wonder if I have to edit my updateIP script to change the mails IP when the ISP changes it?? 3/10/2008 9:22:20 AM |
Shaggy All American 17820 Posts user info edit post |
Quote : | "Run 'tail -n 30 /var/log/maillog' after you try to send a test message and paste it here." |
3/10/2008 9:29:36 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
I've got some config files I need to mess with before I can post the maillog 3/10/2008 12:27:16 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
Ok.. this is weird.. I just checked my yahoo account and found 4 new emails in the BULK folder. they all 4 came from my slackware box..They have to be from testing messages I sent last night as I didn't send any today...
I've replaced the username with myusername and the servers hostname with myhostname.
myusername@myhostname.localdomain
So now I gotta figure out when it was working based on these emails... 3/10/2008 7:17:25 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
looks like these are the 4 that made it through...
Mar 10 15:15:16 hostname postfix/smtp[19183]: 2A11EF7DAA: to=<name@yahoo.com>, relay=c.mx.mail.yahoo.com[216.39.53.3]:25, del ay=17046, delays=17035/0.01/0.76/10, dsn=2.0.0, status=sent (250 ok dirdel) Mar 10 16:05:06 hostname postfix/smtp[19659]: 156BCF7D71: to=<name@yahoo.com>, relay=g.mx.mail.yahoo.com[206.190.53.191]:25, delay=63147, delays=63146/0.01/0.55/0.26, dsn=2.0.0, status=sent (250 ok dirdel) Mar 10 17:11:48 hostname postfix/smtp[20257]: 82154F7D79: to=<name@yahoo.com>, relay=f.mx.mail.yahoo.com[209.191.88.247]:25, delay=66182, delays=66180/0.15/1.7/0.54, dsn=2.0.0, status=sent (250 ok dirdel) Mar 10 18:18:27 hostname postfix/smtp[20538]: 284D0F7DA9: to=<name@yahoo.com>, relay=d.mx.mail.yahoo.com[216.39.53.2]:25, del ay=28073, delays=28072/0.01/0.32/0.19, dsn=2.0.0, status=sent (250 ok dirdel)
full headers from yahoo for one email
From username@hostname.localdomain Mon Mar 10 07:31:10 2008 X-Apparently-To: name@yahoo.com via 216.252.110.216; Mon, 10 Mar 2008 12:15:16 -0700 X-YahooFilteredBulk: my ip X-Originating-IP: [my ip] Return-Path: <username@hostname.localdomain> Authentication-Results: mta278.mail.re4.yahoo.com from=hostname.localdomai; domainkeys=neutral (no sig) Received: from my ip (EHLO hostname.localdomain) (myip) by mta278.mail.re4.yahoo.com with SMTP; Mon, 10 Mar 2008 12:15:06 -0700 Received: by hostname.localdomain (Postfix, from userid 1000) id 2A11EF7DAA; Mon, 10 Mar 2008 10:31:10 -0400 (EDT) Date: Mon, 10 Mar 2008 10:31:10 -0400 To: name@yahoo.com Subject: test2 User-Agent: nail 11.25 7/29/05 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20080310143146.2A11EF7DAA@hostname.localdomain> From: username@hostname.localdomain Add Mobile Alert Content-Length: 5
test
maillog after I sent a new test message
Mar 10 21:55:03 hostname postfix/local[21393]: fatal: open database /etc/aliases.db: No such file or directory Mar 10 21:55:04 hostname postfix/master[17692]: warning: process /usr/libexec/postfix/local pid 21393 exit status 1 Mar 10 21:55:04 hostname postfix/master[17692]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 10 21:55:48 hostname postfix/pickup[20985]: 9EA8AAFDDE: uid=1000 from=<username:> Mar 10 21:55:48 hostname postfix/cleanup[21397]: 9EA8AAFDDE: message-id=<20080311015548.9EA8AAFDDE@hostname.localdomain> Mar 10 21:55:48 hostname postfix/qmgr[21018]: 9EA8AAFDDE: from=<username:@hostname.localdomain>, size=445, nrcpt=1 (queue act ive) Mar 10 21:55:49 hostname postfix/smtp[21399]: 9EA8AAFDDE: host c.mx.mail.yahoo.com[216.39.53.3] refused to talk to me: 553 Ma il from myip not allowed - 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see http://postmaster.yah oo.com/550-bl21.html [550] Mar 10 21:55:49 hostname postfix/smtp[21399]: 9EA8AAFDDE: host a.mx.mail.yahoo.com[209.191.118.103] refused to talk to me: 55 3 Mail from myip not allowed - 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see http://postmaster .yahoo.com/550-bl21.html [550] Mar 10 21:55:52 hostname postfix/smtp[21399]: 9EA8AAFDDE: host g.mx.mail.yahoo.com[209.191.88.239] refused to talk to me: 421 Message from (myip) temporarily deferred - 4.16.50. Please refer to http://help.yahoo.com/help/us/mail/defer/defer-06.html Mar 10 21:55:52 hostname postfix/smtp[21399]: 9EA8AAFDDE: host e.mx.mail.yahoo.com[216.39.53.1] refused to talk to me: 553 Ma il from myip not allowed - 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see http://postmaster.yah oo.com/550-bl21.html [550] Mar 10 21:55:52 hostname postfix/smtp[21399]: 9EA8AAFDDE: to=<email@yahoo.com>, relay=f.mx.mail.yahoo.com[68.142.202.247]:25, delay=4.3, delays=0.01/0.01/4.3/0, dsn=4.0.0, status=deferred (host f.mx.mail.yahoo.com[68.142.202.247] refused to talk to m e: 553 Mail from myip not allowed - 5.7.1 [BL21] Connections not accepted from IP addresses on Spamhaus PBL; see http://postm aster.yahoo.com/550-bl21.html [550]) Mar 10 21:56:04 hostname postfix/local[21402]: fatal: open database /etc/aliases.db: No such file or directory Mar 10 21:56:05 hostname postfix/master[17692]: warning: process /usr/libexec/postfix/local pid 21402 exit status 1 Mar 10 21:56:05 hostname postfix/master[17692]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 10 21:57:05 hostname postfix/local[21403]: fatal: open database /etc/aliases.db: No such file or directory Mar 10 21:57:06 hostname postfix/master[17692]: warning: process /usr/libexec/postfix/local pid 21403 exit status 1 Mar 10 21:57:06 hostname postfix/master[17692]: warning: /usr/libexec/postfix/local: bad command startup -- throttling
[Edited on March 10, 2008 at 9:00 PM. Reason : .] 3/10/2008 8:39:38 PM |
evan All American 27701 Posts user info edit post |
Quote : | "Connections not accepted from IP addresses on Spamhaus PBL;" |
yahoo's MTA won't accept mail from your IP since it's on the spamhaus list - probably because it's dynamic. the 421 error is due to the 553.
(so the problem is what i originally said.)
use a smarthost instead of directly delivering mail from your server.
vi /etc/postfix/main.cf (or whatever other text editor you like) add/edit this: relayhost = your.isps.smtp.server
(note that this needs to be a smtp server that doesn't require auth (time warner's don't as long as you're on their network))
save, close, and restart postfix. (most likely /etc/init.d/postfix restart)
also, run the following:
touch /etc/aliases.db;chown postfix /etc/aliases.db;chgrp postfix /etc/aliases.db;chmod u+x /etc/aliases.db
and change your hostname. ]3/10/2008 11:16:17 PM |
llama All American 841 Posts user info edit post |
I don't really have anything useful to add since the resolution has been posted, but
chown postfix /etc/aliases.db;chgrp postfix /etc/aliases.db
can be condensed into
chown postfix:postfix /etc/aliases.db
for future reference 3/11/2008 7:09:30 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
added the ISPs smtp address and changed the hostname to myhostname.us
Mar 11 10:39:36 myhostname postfix/smtp[24874]: A2398AFE00: to=<root@myhostname.localdomain>, relay=smtpauth.earthlink.net[207.69.189.209]:25, delay=52, delays=0/47/0.22/5, dsn=5.0.0, status=bounced (host smtpauth.earthlink.net[207.69.189.209] said: 550 Please configure your mail client to use authentication. (in reply to RCPT TO command))
myhostname is my actually my hostname, changed for privacy
also getting this Mar 11 10:39:37 myhostname postfix/master[24866]: warning: process /usr/libexec/postfix/local pid 24913 exit status 1 Mar 11 10:39:37 myhostname postfix/master[24866]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 10:40:37 myhostname postfix/local[24914]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 10:40:38 myhostname postfix/master[24866]: warning: process /usr/libexec/postfix/local pid 24914 exit status 1 Mar 11 10:40:38 myhostname postfix/master[24866]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 10:41:38 myhostname postfix/local[24918]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 10:41:39 myhostname postfix/master[24866]: warning: process /usr/libexec/postfix/local pid 24918 exit status 1 Mar 11 10:41:39 myhostname postfix/master[24866]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 10:42:39 myhostname postfix/local[24923]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 10:42:40 myhostname postfix/master[24866]: warning: process /usr/libexec/postfix/local pid 24923 exit status 1 Mar 11 10:42:40 myhostname postfix/master[24866]: warning: /usr/libexec/postfix/local: bad command startup -- throttling
[Edited on March 11, 2008 at 9:44 AM. Reason : .] 3/11/2008 9:42:03 AM |
evan All American 27701 Posts user info edit post |
your smtp server wants you to authenticate
postfix can't do that.
doesn't earthlink have a smtp server that doesn't require authentication?
also
try:
postmap /etc/aliases ] 3/11/2008 10:08:56 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
Quote : | "doesn't earthlink have a smtp server that doesn't require authentication?" |
If they do I can't find it. I bought my domain through godaddy.com can I get my smtp from them?
I also do DNS and forwarding at zoneedit.com3/11/2008 10:17:53 AM |
evan All American 27701 Posts user info edit post |
try smtp.earthlink.net 3/11/2008 10:20:18 AM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
ok that worked and a test email came through within a few seconds. Wasn't even blocked by the BULK/spam filter!
Mar 11 11:34:35 hostname postfix/smtp[25337]: DBFBEAFDEE: to=<email@yahoo.com>, relay=smtp.earthlink.net[209.86.93.210]:25, delay=2.5, delays=0/0/0.15/2.3, dsn=2.0.0, status=sent (250 OK id=1JZ6Uu-0006mW-00) 3/11/2008 10:41:14 AM |
JoeSchmoe All American 1219 Posts user info edit post |
look at all you fucking spammers.
:grr: 3/11/2008 2:12:05 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
stfu. I'm only spamming MYSELF!
ok evan what do I do about this?
Mar 11 15:11:42 hostname postfix/master[26654]: warning: process /usr/libexec/postfix/local pid 26817 exit status 1 Mar 11 15:11:42 hostname postfix/master[26654]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 15:12:42 hostname postfix/local[26818]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 15:12:43 hostname postfix/master[26654]: warning: process /usr/libexec/postfix/local pid 26818 exit status 1 Mar 11 15:12:43 hostname postfix/master[26654]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 15:13:43 hostname postfix/local[26823]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 15:13:44 hostname postfix/master[26654]: warning: process /usr/libexec/postfix/local pid 26823 exit status 1 Mar 11 15:13:44 hostname postfix/master[26654]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 15:14:44 hostname postfix/local[26826]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 15:14:45 hostname postfix/master[26654]: warning: process /usr/libexec/postfix/local pid 26826 exit status 1 Mar 11 15:14:45 hostname postfix/master[26654]: warning: /usr/libexec/postfix/local: bad command startup -- throttling Mar 11 15:15:06 hostname postfix/pickup[26655]: 4D6CCF7D96: uid=0 from=<root> Mar 11 15:15:06 hostname postfix/cleanup[26848]: 4D6CCF7D96: message-id=<20080311191506.4D6CCF7D96@hostname.us> Mar 11 15:15:06 hostname postfix/qmgr[26656]: 4D6CCF7D96: from=<root@hostname.us>, size=1443, nrcpt=1 (queue active) Mar 11 15:15:45 hostname postfix/local[26850]: fatal: open database /etc/aliases.db: Bad file descriptor Mar 11 15:15:46 hostname postfix/master[26654]: warning: process /usr/libexec/postfix/local pid 26850 exit status 1 Mar 11 15:15:46 hostname postfix/master[26654]: warning: /usr/libexec/postfix/local: bad command startup -- throttling
-rw-rw-rw- 1 postfix postfix 21 2008-03-11 14:36 aliases -rw-rw-rw- 1 postfix postfix 0 2008-03-11 14:42 aliases.db
cat aliases webmaster : myusername
newaliases postalias: fatal: cannot remove zero-length database file /etc/aliases.db: Permission denied
[Edited on March 11, 2008 at 2:23 PM. Reason : .] 3/11/2008 2:14:51 PM |
evan All American 27701 Posts user info edit post |
log in as root (or su)
rm -f /etc/aliases.db postmap /etc/aliases 3/11/2008 3:02:36 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
i tried that before but..
# postmap /etc/aliases postmap: fatal: open database /etc/aliases.db: Permission denied 3/11/2008 3:32:29 PM |
XSMP All American 16674 Posts user info edit post |
gg evan 3/11/2008 3:35:26 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
is it because postfix is trying to run the command but can't write to /etc?
drwxr-xr-x 57 root root 8192 2008-03-11 16:31 etc/ 3/11/2008 3:44:44 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
cp aliases aliases.db then ran new aliases and didn't get any errors.
I can send from my PC to internet mail but I can not receive mail on my PC if I reply from the internet mail to my username on the pc
Mar 12 16:08:40 myhostname.us postfix/postfix-script: stopping the Postfix mail system Mar 12 16:08:40 myhostname.us postfix/master[26654]: terminating on signal 15 Mar 12 16:08:41 myhostname.us postfix/postfix-script: warning: group or other writable: /etc/postfix/./aliases Mar 12 16:08:41 myhostname.us postfix/postfix-script: starting the Postfix mail system Mar 12 16:08:41 myhostname.us postfix/master[1048]: daemon started -- version 2.3.3, configuration /etc/postfix Mar 12 16:15:06 myhostname.us postfix/pickup[1049]: E5326AFDE9: uid=0 from=<root> Mar 12 16:15:06 myhostname.us postfix/cleanup[1112]: E5326AFDE9: message-id=<20080312201506.E5326AFDE9@myhostname.us.us> Mar 12 16:15:06 myhostname.us postfix/qmgr[1050]: E5326AFDE9: from=<root@myhostname.us.us>, size=1443, nrcpt=1 (queue active) Mar 12 16:15:06 myhostname.us postfix/local[1114]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Mar 12 16:15:06 myhostname.us postfix/local[1114]: E5326AFDE9: to=<myusername@myhostname.us.us>, orig_to=<root>, relay=local, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox) Mar 12 16:15:06 myhostname.us postfix/qmgr[1050]: E5326AFDE9: removed
# postmap /etc/aliases postmap: warning: /etc/aliases, line 15: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 16: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 19: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 20: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 21: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 22: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 23: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 24: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 25: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 26: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 29: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 31: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 32: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 33: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 34: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 37: record is in "key: value" format; is this an alias file? postmap: warning: /etc/aliases, line 233: record is in "key: value" format; is this an alias file?
[Edited on March 12, 2008 at 3:23 PM. Reason : .] 3/12/2008 3:22:35 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
appears I fixed the nis error
Mar 12 17:35:05 hostname postfix/postfix-script: starting the Postfix mail system Mar 12 17:35:05 hostname postfix/master[3145]: daemon started -- version 2.3.3, configuration /etc/postfix
# postconf | grep alias | grep nis alias_maps = hash:/etc/aliases, nis:mail.aliases
to
# postconf | grep alias | grep nis alias_maps = hash:/etc/aliases
still can't figure out why I cant receive mail from the internet on my pc..
[Edited on March 12, 2008 at 4:42 PM. Reason : .] 3/12/2008 4:14:04 PM |
ncsuapex SpaceForRent 37776 Posts user info edit post |
port 25 FTW
thanks evan 3/12/2008 8:08:58 PM |