LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I send mails to multiple addresses in a txt file (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-send-mails-to-multiple-addresses-in-a-txt-file-482073/)

will824 09-10-2006 02:35 AM

How can I send mails to multiple addresses in a txt file
 
Hi.

I am a monitor on Algorithms in my university. The course has around 400 Students, so I asked wach teacher to send me a xls file with all their mails. Now I need to seend bulk informative mail.
I could just create a grup of 30 students for each group in mozilla, but it would take a loooong time, time I dont really have and I find it quite inefficient.

So my question is if you know of a way automatize the sending of all 400 mails.

I really need help on this topic and havent been able to find information in the web.
Thanks in advance for all your help.

jonaskoelker 09-10-2006 07:13 AM

I think the best way would be to set up a mailing list and add all 400 people to it. If you can't do that, then do the following:
Code:

for recv in $(cat file-with-email-addresses.txt); do
    mail -s "my favorite subject" $recv < content-of-email.txt
done

This assumes you have set up a mail transfer againt -- such as exim, postfix or sendmail -- which is reasonably easy, and you really should do anyways. If you ISP is an asshole (i.e. blocks outgoing 25/tcp), consider signing up for mailshack and using them as your smarthost on outgoing 2525/tcp.

bigrigdriver 09-10-2006 07:19 AM

Kmail can be setup to use defined mailing lists. Importing the email addresses from an xls file to the mailing list is beyond my ability to describe.

From the reading I've done, when composing new messages, elect to send the message to the mailing list instead of individual users, and the message goes out to all addresses in the list.

will824 09-11-2006 01:20 AM

Problem when sending mails to mail lists
 
bigrigdriver,

Actually, I have tried to send mail to Mail Lists with more than 40 users and most mail SMTP servers would answer that there are too many recipients to send the current mail (I believe it must be some way of controlling SPAM), so now I believe the only way its to do it they way jonaskoelker says so, like using a MTA agent with some programming.

jonaskoelker,

Man, thanks for the information, I am going to try and install a MTA and try the programming you sent me to see if it actually works.

Thanks, Ill post later to tell you about it.

will824 09-13-2006 04:23 AM

Hi
 
Hello!

Iam trying to send the mails using sendEmail and sendmail as the SMTP server, and It worked for a single Mail, but I have yet to do the programming.

How can you create a Mailinglist with 540 (There where more) mails and then get yout ISPs SMTP server to send mail at once to all those address (Normally it would give you an error).

Thanks!

will824 09-13-2006 05:41 AM

Ok, Seems it worked
 
Ok, this is the script I used and it seems that it worked ok

------------------------------------------------------


#Para enviar un correo a todos los estudiantes de algoritmos

msg=$(cat aypmsg12082006)

for adr in $(cat EstudiantesAlgoritmos); do


sendEmail -f "William Cornejo <wecornej@unalmed.edu.co>" \
-t \
$adr \
-u "Importante: Monitoria Algoritmos y Programacion 03-2006" \
-m "$msg" \
-s localhost \
-l logmails
done

-----------------------------------------------------

Thanks for all your help!!!

will824 09-14-2006 09:00 AM

MTA Used
 
Hi all!

I had forgotten to tell you that I didnt use my ISPs SMTP (No relay allowed), instead I installed sendmail (It worked with courier too) and I sent the message with the script via localhost port, as the relay was controlled by me and it was even enabled since the beginning.

I had a little question: It is possible with the script that I send messages to group of addresses instead of sending 540 for each one?. How could I make it and to how many addresses can I send a mail at the time.

Thanks!

jonaskoelker 09-14-2006 01:40 PM

To find out what the spec says, read the RFC. In reality it probably depends on the configuration of the first few MTAs. I would bet you that the first MTA looks at the message and splits it into one per recipient, simply because the delivery process is going to be different. Except maybe if it only needs to forward to a smarthost, in which case the smarthost probably splits it into many.

Which problem gets solved by you sending one message instead of many?

will824 09-14-2006 10:26 PM

Multiple
 
Hi!

Where could I find the RFC?

The thing is that if I send one mail with multiple addresses I will not have to send 540 mails, just 16, for example. So the communication with the SMTP server will be more eficient.

Thanks.

PD: One notice... thos emessages I sent.. they did not arrive to the mail addresses... I dont know what happened :(


All times are GMT -5. The time now is 02:34 AM.