Discussion:
[OT] automatic mail bash script
lore
2007-06-06 10:29:54 UTC
Permalink
hi all,
I have a problem...I need that my postfix send me ( on gmail account ) an
email after the server started up. Can I use the same account on gmail to
send it?
I've tryed with

mail -s test ***@gmail.com < mail_text

the cat of mail_text is

test test test
.

but the answer is: Mail Delivery Status Report will be mailed to <root>

Could anybody help me? What really i need to change in main.cf?

thanks a lot

lore
--
- buena mista social ska -
Morten Nilsen
2007-06-06 12:19:48 UTC
Permalink
Post by lore
hi all,
I have a problem...I need that my postfix send me ( on gmail account ) an
email after the server started up. Can I use the same account on gmail to
send it?
I've tryed with
To get your gmail address into the from line, you would need to format an
RFC822 message, complete with headers and feed it into either your local
print spool, or send it off to an external smtp server yourself..

I suppose your best bet is something along the line of this;
cat mail | sendmail

The file mail should in this case contain all the headers you need (from,
to, subject, date, message-id, content-type, content-disposition, etc..)

Alternatively, if you invoke sendmail with some parameters, it can insert
headers for you - refer to the sendmail manpage.


Some related info;

cat mail | mail -s test ***@gmail.com

no trailing . needed in the file
you could even use echo 'server up' rather than 'cat mail'

for testing MTAs, I frequently pipe 'date' through 'mail'
Post by lore
the cat of mail_text is
test test test
.
but the answer is: Mail Delivery Status Report will be mailed to <root>
What do you mean by "answer"?
That the MDSR would be delivered to <root> is quite expected, as root was
the sender..
Post by lore
Could anybody help me? What really i need to change in main.cf?
You might want to set local_domain..

--
Cheers,
Morten
:wq
lore
2007-06-06 13:03:26 UTC
Permalink
hi Morten,

Alternatively, if you invoke sendmail with some parameters, it can insert
Post by Morten Nilsen
headers for you - refer to the sendmail manpage.
ok, i've chosen this way ;o)

Some related info;
| no trailing . needed in the file
Post by Morten Nilsen
you could even use echo 'server up' rather than 'cat mail'
ok...
Post by Morten Nilsen
for testing MTAs, I frequently pipe 'date' through 'mail'
do you mean that if I run

mail -s test ***@gmail.com

I've to recieve an email on ***@gmail.com account ( with subject "test"
and nothing in the body ) from root...is it right? Because i don't recieve
the email
Post by Morten Nilsen
What do you mean by "answer"?
That the MDSR would be delivered to <root> is quite expected, as root was
the sender..
I mean the answer from the command line...when I run the command "mail
-s....." the shell return me that...
Post by Morten Nilsen
Could anybody help me? What really i need to change in main.cf?
You might want to set local_domain..
ok, but i've no domain in my server, because is a home little server and i
need to recieve on mail the ip of ppp0 :)

- buena mista social ska -

Continue reading on narkive:
Loading...