Hello,
I have txt file where I have users emails, number of users can change every month.
example txt:
[email protected]
[email protected]
[email protected]
How I can read and add these users to SMTPSendMail> command ?
Thanks in advance.
Read emails from txt and add them to recipients
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Read emails from txt and add them to recipients
To loop through the email addresses and send them one by one, the structure would be something like this (assuming you already have the regular SMTPSendMail aspects accomplished) :
Code: Select all
readfile>d:\emails.txt,AllTxt
Separate>AllTxt,CRLF,Lines
let>readloop=1
repeat>readloop
Let>thisemail=lines_%readloop%
SMTPSendMail>%thisemail%,post.mail.com,me,myname,subject,body,
let>readloop=readloop+1
Until>readloop,lines_count
Yes, we have a Custom Scripting Service. Message me or go here
Re: Read emails from txt and add them to recipients
Hi,Dorian (MJT support) wrote: ↑Fri Jan 13, 2023 2:28 pmTo loop through the email addresses and send them one by one, the structure would be something like this (assuming you already have the regular SMTPSendMail aspects accomplished) :
Code: Select all
readfile>d:\emails.txt,AllTxt Separate>AllTxt,CRLF,Lines let>readloop=1 repeat>readloop Let>thisemail=lines_%readloop% SMTPSendMail>%thisemail%,post.mail.com,me,myname,subject,body, let>readloop=readloop+1 Until>readloop,lines_count
I want to send one email to all users (all users in recipients field) not a separate email to each user. Is it possible ?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Read emails from txt and add them to recipients
Yes, this does that :
You can also try SMTP_BCCLIST instead of SMTP_CCLIST. However, during my tests (Macro Scheduler 15.0.21) sending via Gmail I noticed this is CCing and not BCCing. Please let me know if you get similar results and I'll mention it to dev.
SMTPSendMail : To include CC or BCC email addresses set the SMTP_CCLIST and SMTP_BCCLIST variables. Separate multiple email address with semicolons.
Code: Select all
readfile>d:\emails.txt,AllTxt
StringReplace>AllTxt,CRLF,;,EmailList
Let>SMTP_CCLIST=EmailList
SMTPSendMail>EmailList,%SMTPServer%,me,myname,Subject,Body,
SMTPSendMail : To include CC or BCC email addresses set the SMTP_CCLIST and SMTP_BCCLIST variables. Separate multiple email address with semicolons.
Yes, we have a Custom Scripting Service. Message me or go here
Re: Read emails from txt and add them to recipients
Thank you!!!Dorian (MJT support) wrote: ↑Mon Jan 16, 2023 9:22 amYes, this does that :
You can also try SMTP_BCCLIST instead of SMTP_CCLIST. However, during my tests (Macro Scheduler 15.0.21) sending via Gmail I noticed this is CCing and not BCCing. Please let me know if you get similar results and I'll mention it to dev.Code: Select all
readfile>d:\emails.txt,AllTxt StringReplace>AllTxt,CRLF,;,EmailList Let>SMTP_CCLIST=EmailList SMTPSendMail>EmailList,%SMTPServer%,me,myname,Subject,Body,
SMTPSendMail : To include CC or BCC email addresses set the SMTP_CCLIST and SMTP_BCCLIST variables. Separate multiple email address with semicolons.
For me everything ok with SMTP_BCCLIST, but I'm sending not via gmail.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Read emails from txt and add them to recipients
Aah, that's good to know. Many thanks.
Yes, we have a Custom Scripting Service. Message me or go here