Unix Programming - mail / how to send a pre-composed multiple mail file?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2007 > mail / how to send a pre-composed multiple mail file?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author mail / how to send a pre-composed multiple mail file?
rhXX

2007-11-29, 7:34 am

hi all,

i would appreciatte your comments on the following:

- i want to prepare a text file with some format similar to:

From: me
To: dest1
Subject: subject1

body1

From: me
To: dest2
Subject: subject2

body2

....


From: me
To: destN
Subject: subjectN

bodyN

- then feed it to some program: xxx < file , which send these
mails

i tried to do that with mail & mailx, but doesnot word, they need the
destination in the command line

tks in advance
rhXX

2007-11-29, 1:30 pm

On Nov 29, 2:45 pm, J de Boyne Pollard <j.deboynepoll...@tesco.net>
wrote:
> Either Batch SMTP or the UUCP "rmail" utility are your friends.


tks a lot!

i was looking for rmail and bsmtp but i don't have those packages :-
(

i think the better way is to make a little prog in Python which parses
the file, and send the emails (???)
Logan Shaw

2007-11-30, 1:47 am

rhXX wrote:
> - i want to prepare a text file with some format similar to:
>
> From: me
> To: dest1
> Subject: subject1
>
> body1
>
> From: me
> To: dest2
> Subject: subject2
>
> body2
>


> - then feed it to some program: xxx < file , which send these
> mails
>
> i tried to do that with mail & mailx, but doesnot word, they need the
> destination in the command line


"sendmail -t" would do what you want if you had each message in a separate
file. The "-t" flag says to "t"ake the addresses from the message header
instead of the command line.

If you really need to get the messages out of a concatenated file, you
might be able to do it with formail. (It depends on how liberal its parsing
is, since I believe it expects mbox format, which would have messages
beginning with "From " -- note no colon.) But then you'd still be running
sendmail once for every message.

- Logan
rhXX

2007-11-30, 7:35 am


> It all depends from how the file is constructed in the first place.
> If it is constructed, for example, by concatenating a series of
> individual message files together, then it's silly to write a program
> to parse the file in order to split it into several individual
> messages when it started off as several individual messages in the
> first place. If you have individual messages in individual files,
> then submitting them is no more than an exercise in shell scripting.


ok, tks!

yes, yesterday i solved my problem with a shell scritp ...

with more details, i wanted to make a cron mail-merge:
- i have a .xls database with language, name, sex & number, treatment,
signing, ...., generic body file
- i exported this db to a .csv file
- i have some generic body files - language
- i cronned my "mail-merge" script
- for each csv record, it takes the associate body-language file,
makes the translation of the fields, and send the mail.

tks for your comments!
my best regards

rhXX

2007-11-30, 7:35 am

> "sendmail -t" would do what you want if you had each message in a separate
> file. The "-t" flag says to "t"ake the addresses from the message header
> instead of the command line.
>
> If you really need to get the messages out of a concatenated file, you
> might be able to do it with formail. (It depends on how liberal its parsing
> is, since I believe it expects mbox format, which would have messages
> beginning with "From " -- note no colon.) But then you'd still be running
> sendmail once for every message.
>
> - Logan


i will test it!

tks a lot!




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com