Extract lines from file, add to new files

Rich Shepard rshepard at appl-ecosys.com
Tue Jan 30 12:21:51 EST 2024


On Tue, 30 Jan 2024, Thomas Passin via Python-list wrote:

> Fine, my toy example will still be applicable. But, you know, you haven't
> told us enough to give you help. Do you want to replace text from values
> in a file? That's been covered. Do you want to send the messages using
> those libraries? You haven't said what you don't know how to do. Something
> else? What is it that you want to do that you don't know how?

Thomas,

For 30 years I've used a bash script using mailx to send messages to a list
of recipients. They have no salutation to personalize each one. Since I want
to add that personalized salutation I decided to write a python script to
replace the bash script.

I have collected 11 docs explaining the smtplib and email modules and
providing example scripts to apply them to send multiple individual messages
with salutations and attachments.

Today I'm going to be reading these. They each recommend using .csv input
files for names and addresses. My first search is learning whether I can
write a single .csv file such as:
"name1","address1"
"mane2","address2"
which I believe will work; and by inserting at the top of the message block
Hi, {yourname}
the name in the .csv file will replace the bracketed place holder.

Still much to learn and the batch of downloaded PDF files should educate me.

Regards,

Rich


More information about the Python-list mailing list