Using Outlook Distribution List

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Using Outlook Distribution List

Post by Dexter1 » Thu Jun 22, 2006 7:23 pm

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%
Thanks,
Josh

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Thu Jun 22, 2006 7:44 pm

Oops. Upon further searches I see that I cannot use a Distribution List. Has anybody created any kind of work-around for this? I don't want to have to maintain the Distribution List as well as the list of emails in the macro.
Thanks,
Josh

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jun 22, 2006 7:47 pm

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.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Thu Jun 22, 2006 8:21 pm

I decided to just add them all to the macro. They lists don't change all that much.

While I have your attention, is there a way to put a return in the body of the email? I want to add my signature.

I appreciate all your help.
Thanks,
Josh

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Jun 22, 2006 8:52 pm

If you are sending to a distribution list it's a lot neater to use SMTP_BCCLIST and send them all as bcc's, and just have your email as the only "to". You don't share everyone's address that way either.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Thu Jun 22, 2006 10:08 pm

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.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jun 22, 2006 10:34 pm

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

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts