|
|
#1 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
Sendmail and the mail command
Hi
I want to use the mail command to send email from the command line like so: mail -s "subject of email" emailaddress@whatever.com<textfile.txt However I have the impression that I need to turn Sendmail on in order to do this. Well I don't want to turn Sendmail on if I can avoid it, I won't want Sendmail to accept email just send it... a. How do I get it to do this? How do I configure it? b. What mail server do I aim this at? My isp's existing pop server? |
|
|
|
|
|
#2 |
|
Prospect
Join Date: Mar 2002
Posts: 4
|
If your internet connection is up, you should be able to run the mail command without turning sendmail on.
Sendmail is an SMTP server. In most setups, you will use your ISP's SMTP server for outgoing email and POP/IMAP for incoming email. If you had a slow dial-up connection and wanted to limit your dial-ins, you might run sendmail to provide "store and forward" functionality (i.e., your local sendmail server would store outgoing mail until a connection was established). GUI e-mail clients usually provide "store and forward" capabilities, a.k.a. offline mode or send mail later. The mail command doesn't, so you need to make there is something to recieve the email from the mail command -- either a local sendmail or your ISP's SMTP server. The latter requires an active internet connection, the former does not. Hope this helps, Gary. |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
mail is just a user interface to the mail delivery agent, sendmail, which can be run as a daemon service
you don't need to do anything special, just address email to a valid email address and sendmail will deliver % man sendmail ... Sendmail is not intended as a user interface routine; other programs provide user-friendly front ends; sendmail is used only to deliver pre-formatted messages. [and] -bd Run as a daemon. This requires Berkeley IPC. Sendmail will fork and run in background listening on socket 25 for incoming SMTP connections. This is normally run from /etc/rc. ... here's a test. i don't have sendmail daemon running. i started a background top logger to capture sendmail in the act... Code:
$ ps wwax | grep send 10369 std R+ 0:00.00 grep send $ top -l100 > top.txt & [1] 10065 $ mail -s "test" merv test . EOT $ % top -l100 >top.txt ^C $ grep send top.txt 10071 sendmail 0.0% 0:00.01 1 16 15 80K 364K 332K 1.46M 10073 sendmail 0.0% 0:00.02 1 9 18 356K 672K 520K 1.84M sendmail will screech if any of the dirs in the chain /etc/mail are group writable, unless the #O DontBlameSendmail=safe is enabled in /etc/mail/sendmail.cf Last edited by mervTormel; 03-26-2002 at 02:52 PM. |
|
|
|
|
|
#4 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
group writeable directory?
Ok
I tried mail command as my usual user id: and got: jamesk @ /Users/jamesk@HOME-->/etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory the perms on /etc/mail/local-host-names are: -r--r--r-- 1 root wheel 0 Sep 2 2001 /etc/mail/local-host-names so then I tried to do it as root: root @ /Users/jamesk @home-->/etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory somehow I suspect that the perms on /etc/mail/local-host-names still ain't right: btw the line in sendmail.cf the error refers to is: Cwlocalhost # file containing names of hosts for which we receive email Fw/etc/mail/local-host-names |
|
|
|
|
|
#5 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
here's an authoratative post on the sendmail gak...
http://forums.macosxhints.com/showth...&threadid=1467 the root dir / is group-write enabled. removing that will make your mailman less disgruntled. note that the first thing that every apple software update does is chmod 1775 / so you have to add that notion to your administration. *sigh* |
|
|
|
|
|
#6 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
sendmail will screech if any of the dirs in the chain /etc/mail are group writable, unless the
#O DontBlameSendmail=safe is enabled in /etc/mail/sendmail.cf merv...I don't know all the particulars but I was advised strongly not to do this....it leaves the system vulnerable....will try to find out why and post what I find. jim |
|
|
|
|
|
#7 |
|
Major Leaguer
Join Date: Jan 2002
Location: Midwest Not quite Normal
Posts: 416
|
isp problem
My isp blocks all outgoing mail unless it is sent through their smtp, or hotmail, or webmail. Something about spam. So how do we tell sendmail how to route to that?
|
|
|
|
|
|
#8 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
yeh port 25
Yeh that's called port 25 filtering and it is due to spam and is an attempt on the part of isp's to come to grips with the problem. I believe you can just aim your box at one of their smtp servers via sendmail.cf but I must admit I'm not a sendmail guru. Maybe someone else has the exact config.
|
|
|
|
|
|
#9 |
|
Prospect
Join Date: Mar 2002
Posts: 4
|
Smart Relay
I believe you want to define your "smart relay host" via the DS macro. I haven't verified this as I have never looked at the sendmail.cf on the mac. Here's an example.
Code:
# replace smtp.isp.com with your ISP's smtp server name. DSsmtp.isp.com Just search for "DS" in your sendmail.cf file. It should be documented within the file. Hope this helps, Gary. |
|
|
|
|
|
#10 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
ok now I'm confused
DSsmtp.isp.com
how do you determine the hostname here? Do you call up your isp and ask for their "smart" relay smtp server? jk |
|
|
|
|
|
#11 | ||||||||||||||||||||||||||||||||||||||
|
Prospect
Join Date: Mar 2002
Posts: 4
|
Smart Relay == ISP's SMTP server
I'm not sure where the confusion is?
You asked:
Yet my reply was was in response to your statement:
You can aim your box at your ISP's smtp server by using the DS macro in the sendmail.cf file. "Smart Relay" is just sendmail speak for "outgoing mail server". It's the same hostname you would specify in your mail client (Mail app, Outlook, etc.) as your outgoing mail server. Example, I use Bakersfield Road Runner as my ISP. When I signed up, they gave me the following information. Incoming mail server: pop-server.bak.rr.com Outgoing mail server: smtp-server.bak.rr.com If I wanted to send via the unix mail command, I would make sure that my sendmail.cf file had a line that looked like this: Code:
DSsmtp-server.bak.rr.com Clear as mud?!? Gary |
||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#12 |
|
Major Leaguer
Join Date: Jan 2002
Location: Gaithersburg, MD
Posts: 494
|
aaahhh gotcha
sorry
just got lost in a bit of a sendmail speak circle. Thanks I'm clear now. jim |
|
|
|
|
|
#13 |
|
Registered User
Join Date: Feb 2005
Posts: 1
|
Mail() and Sendmail problems.
I have some kind of problem that I cant solve..
My webbsite on my linux machine worked perfectly after I had configured my website. After a reboot the mail() function stopped working. Sendmail works perfectly. If I look insida the maillog I can see that mail() triggers sendmail but it doesnt insert the correct information like where to send the mail. I have tried this: mail("me@mymail.com", "subject", "message", "From: myself"); And I get this in the log: Feb 9 12:31:01 server sendmail[16975]: j19BV1v9016975: from=nobody, size=42, class=0, nrcpts=0, msgid=<200502091131.j19BV1v9016975@server.host.com>, relay=nobody@localhost When I use the Sendmail application directly I get a better log. Anyone that could help me? // z3eed |
|
|
|
|
|
#14 | |||||||||||||||||||||||
|
Site Admin
Join Date: Dec 2001
Location: Minneapolis, MN
Posts: 3,988
|
You might want to look for a newsgroup or help site that's related to whatever Linux distribution you're using. Although I don't doubt there are folks here with considerable Linux expertise this is still really a Mac OS X related site. Best of luck!
|
|||||||||||||||||||||||
|
|
|
![]() |
|
|