Is there a way to use a Distribution List instead of an email address when using SMTPSendMail>?
Here's the code I have thus far. It works just fine with an actual email address.
input>StartDate, Enter Start Date
input>EndDate, Enter End Date
input>WeekNumber, Enter Week Number
Let>SendMail_Status=1
Let>Subject=Test Message from %StartDate% to %EndDate%
Let>me=[email protected]
Let>MyName=Sly Stallone
Let>Recipients=[email protected]
Let>body=Testing new email method.
SMTPSendMail>recipients,email.is.ad.email.net,me,myname,subject,body,
Message>result of SendMail: %SMTP_Result%
Using Outlook Distribution List
Moderators: JRL, Dorian (MJT support)
Using Outlook Distribution List
Thanks,
Josh
Josh
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
A few comments:
1. variables are Case Sensitive, "Recipients" is not the same as "recipients"
\2. Recipients can be multiple email addresses, separated with semicolon, like [email protected];[email protected];[email protected]
3. You could have multiple text documents with email addresses separated by semicolons, and read those files in as %Recipients%. This would allow you to have multiple email group lists, just select the one you want at run time with a prompt to select. Or make a loop and cycle through multiple lists if you wanted to do that.
1. variables are Case Sensitive, "Recipients" is not the same as "recipients"
\2. Recipients can be multiple email addresses, separated with semicolon, like [email protected];[email protected];[email protected]
3. You could have multiple text documents with email addresses separated by semicolons, and read those files in as %Recipients%. This would allow you to have multiple email group lists, just select the one you want at run time with a prompt to select. Or make a loop and cycle through multiple lists if you wanted to do that.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
if you want to put a 'return' in the body of the email, you might try the string %CRLF% which is used in other places in macroSched for CarriageReturn LineFeed... I have not yet tested it with SMTPSendMail, but that's where I would start.
so....My First line My Second Line
would become...
My First Line%CRLF%My Second Line
this should return two seperate lines.
so....My First line My Second Line
would become...
My First Line%CRLF%My Second Line
this should return two seperate lines.
I can confirm that %CRLF% in the body of an email message will produce a second line in the message. I've used it many times.
If the message is going to be long, you may want to set the body of the message to a variable, then concat> the text followed by a %CRLF% one line at a time. Its easier to read/type that way rather than trying to read/type a long continuous line
example
Let>body=
Let>comma=,
Concat>body,Hello World%comma%%CRLF%%CRLF%
Concat>body, The purpose of this message is to confirm the use%CRLF%
Concat>body,of the Carriage Return Line Feed variable as a provider of%CRLF%
Concat>body,multiple lines of text in an email message.%CRLF%CRLF%
Concat>body,Thank you%comma%%CRLF%
Concat>body,Dick%CRLF%[email protected]
Then use the variable body in the SMTPSendMail> line
Also:
I have used the method that Bob mentions for multiple reciplients. I have a text file with multiple lines of email addresses, I read the file then loop through the list one email at a time sending the same message to everyone on the list. Like Me_again mentioned talking about SMTP_BCCLIST, one nice thing about this method is that each individual only sees their own address in the message.
I think that variables used to be case sensitive but I don't think they are if you are using version 7 or 8. Labels and subroutine names are case sensitive. and I think that system variables are still required to be in upper case though I admit I have not tried to use lower or mixed case to test them out.
Later,
Dick
If the message is going to be long, you may want to set the body of the message to a variable, then concat> the text followed by a %CRLF% one line at a time. Its easier to read/type that way rather than trying to read/type a long continuous line
example
Let>body=
Let>comma=,
Concat>body,Hello World%comma%%CRLF%%CRLF%
Concat>body, The purpose of this message is to confirm the use%CRLF%
Concat>body,of the Carriage Return Line Feed variable as a provider of%CRLF%
Concat>body,multiple lines of text in an email message.%CRLF%CRLF%
Concat>body,Thank you%comma%%CRLF%
Concat>body,Dick%CRLF%[email protected]
Then use the variable body in the SMTPSendMail> line
Also:
I have used the method that Bob mentions for multiple reciplients. I have a text file with multiple lines of email addresses, I read the file then loop through the list one email at a time sending the same message to everyone on the list. Like Me_again mentioned talking about SMTP_BCCLIST, one nice thing about this method is that each individual only sees their own address in the message.
I think that variables used to be case sensitive but I don't think they are if you are using version 7 or 8. Labels and subroutine names are case sensitive. and I think that system variables are still required to be in upper case though I admit I have not tried to use lower or mixed case to test them out.
Later,
Dick