Click to See Complete Forum and Search --> : Ultimate Email Irritation


janice
04-02-2004, 08:46 AM
Hello everyone,
Let me explain the issue first, then I will ask the question.

We have an email program that sends out weekly emails to top executives in our company letting them know if events unfold within the company.

The email works well as it is.
But recently, one of the executives wanted to cc his secretary so that in the event he is not around, his secretary will take care of whatever demands his attention.

The first thing we did as a temporary solution was to add a cc to the email code.
Problem that presented was that the secretary was getting copied on emails she didn't need.

The next option we tried was to concatenate the secretary's email address with that of the executive as one field on our database since the email addresses are getting pulled from our database.
There were problems with that also.

I have decided to create some if statement within the email address which says: if the email address being pulled from the db matches that of this particular executive's email, then copy his secretary, else don't copy her.
It isn't doing anything.
Can someone please take a look and help me figure out what I might be doing wrong.

Here is the code snip:

<%
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "gtc021"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
Flds.Update
With iMsg
Set .Configuration = iConf
.From = "admin@yahoo.com"
.To = ""&staffemail&""
.Sender = "admin@yahoo.com"
If &staffmail& = "johnDoe@home.com" then
.cc = "hisStaff@work.com"
end if
.Subject = "From Director's Office - Accident Occurrence"
.TextBody = "This is your incident report."
.Send
End With

'end of email code
'---------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------

Thanks in advance

lcscne
04-02-2004, 11:17 AM
Originally posted by janice
If &staffmail& = "johnDoe@home.com" then


2 ideas

1) write the above line like this

If staffmail = "johnDoe@home.com" then 'without ampersans

2) forget the code idea and write a vacation rule in the execs email that auto responds/forwards and show him how to turn the rule on and off.

lcscne
04-02-2004, 11:21 AM
if that still fails try:

If staffmail = " johnDoe@home.com " then

make sure " johnDoe@home.com " has a preceding space and one at the end too.

I can't tell if the line .To = ""&staffemail&"" is adding spaces or not kinda looks pointless to me. Regardless you shouldn't have the ampersands in the if statement.

I really recommend the email rule path though.

janice
04-04-2004, 09:16 PM
Thanks,
I decided to with the email rule as you suggested, even though your other suggestion also worked.
Thank you!