Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using an If..then statement to cc: on form emails 1

Status
Not open for further replies.

candidar

Programmer
Dec 5, 2003
4
US
Here is what I am trying to do. I am trying to write an If then statement that will cc via email a particular person based on a selection from a drop down menu. This works great. Now, what I want to do is make sure that the person who is sending in the form is not cc is they select the cc selection.
So, if you are sending a request email to me, via the form to change information on a site you are responsible for, it will not cc you. We are trying to cc to people who are responsible for their site is SOMEONE else wants to changes it.
I hope that makes sense, it will if you read the code. I am super blonde today, and can not figure out for the life of me how to get this to work....



<%

On error resume next

Dim mySmartMail
Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail")
Dim mySmartUpload
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
Dim intCount


' CRL/073004: This str call is only for the .js, so it will display the selection in the e-mail.

Dim strbucket
Dim strrequester
strbucket = Request("site_selection")
strrequester = Request("SenderName")

' Upload
' ******
mySmartUpload.Upload

' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
intCount = mySmartUpload.Save("../_upload/")
' sample with a physical path
' intCount = mySmartUpload.Save("c:\temp\")

' Mail Server
' ***********
mySmartMail.Server = "165.253.179.195"

' From
' ****
mySmartMail.SenderName = Request("SenderName")
mySmartMail.SenderAddress = Request("Sender")


' To
' **
mySmartMail.Recipients.Add Request("ToAddress")


' CRL/073004: We are using a very extensive cc if/then statement(s). The cc list is based on the co
' list and must be kept updated. We want the co's to be cc on any requests that effects their
' assigned web page(s).


' Carbon copy
' ***********
mySmartMail.CCs.Add Request("Sender")

If (strbucket ="HR Contacts") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "debbie.navarro@blueshieldca.com"
End If

If (strbucket ="Careers") or (strbucket ="Recruitment & Staffing") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "bonnie.sarkisian@blueshieldca.com"
End If

If (strbucket ="Benefits") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "melissa.clark@blueshieldca.com"
End If

If (strbucket ="Benefits:LOA") or (strbucket ="Safety, Workers Comp & Injury on the Job") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "kerry.daley@blueshieldca.com"
End If

If (strbucket ="Benefits:Tuition Assistance") or (strbucket ="Benefits:Reimbursement") or (strbucket ="Performance Management") or (strbucket ="Corporate Guidelines:Values") or (strbucket ="Learning & OD:performance Management") or (strbucket ="Learning & OD:Leadership Principles & Behaviors") or (strbucket ="Learning & OD:Foundations of Management") or (strbucket ="Learning & OD:Training Programs") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "kathy.richards@blueshieldca.com"
End If

If (strbucket ="Directors & Above") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com", "candida.rodriguez@blueshieldca.com"
' "kathy.richards@blueshieldca.com", "john.mark@blueshieldca.com"
End If

If (strbucket ="Benefites:Sholarship Program") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "michele.row@blueshieldca.com"
End If

If (strbucket ="Payroll") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "lori.bolt@blueshieldca.com"
End If

If (strbucket ="Compensation") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "lena.hwang@blueshieldca.com"
End If

If (strbucket ="Employee Recognition") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "marianne.jackson@blueshieldca.com"
End If

If (strbucket ="Corporate Guidelines") or (strbucket ="HR Legal Library") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "cathy.murphy@blueshieldca.com"
End If

If (strbucket ="Ergonomics, Safety & Injury Prevention") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "parcae.lockman@blueshieldca.com"
End If

If (strbucket ="Learning & OD:Change Capacity") or (strbucket ="Learning & OD:Org. Design & Development") Then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "kim.arnold@blueshieldca.com"
End If


' CRL/073004: The priorty parameter gives the ! in front of important e-mails. The HR Web Team also
' decided to go with the 'prettied up' html version.

' Parameter
' *********
mySmartMail.Priority = Request("Priority")
mySmartMail.ContentType = "text/html"
' mySmartMail.Charset = "us-ascii"
' mySmartMail.Encoding = "base64"


' CRL073004: The e-mail is kinda long, but the HR Web Team wanted links m=back to important areas in
' their site. Currently the URL hyper link is not working.

' Message
' *******
mySmartMail.Subject = Request("RequestType") & "- " & " Target Due Date: " & Request("DueDate")
txtBody = txtBody & "<font face=Arial size=2><b>Please Note:</b> If you have been copied on this request, it is because you are the content owner for the section cited below. The requester should partner with the content owner (if applicable) concerning any changes, additions or deletions to the cited section. To learn more about this process, please review <a href= Submitting an HR Web Request</a>." & "<br>"
txtBody = txtBody & "<br>"
txtBody = txtBody & "<b>HR Web Team Online Request Form Results:</b>" & "<br>"
txtBody = txtBody & "Thank you " & Request("SenderName") & " for submitting your HR Web Team Online Request Form on " & Now & " for review and approval. You will be contacted on the status of your request within a 24 hour period. If you are planning an e-mail communication in conjunction with your requested changes, please contact the HR Web Team." & "<br>" & "<br>"
txtBody = txtBody & "<b>Email Address:</b> " & Request("Sender") & "<br>"
txtBody = txtBody & "<b>Name:</b> " & Request("SenderName") & "<br>"
txtBody = txtBody & "<b>Telephone:</b> (" & Request("Phone1") & ") " & Request("Phone2") & "-" & Request("Phone3") & " Ext: " & Request("Phone4") & "<br>"
txtBody = txtBody & "<b>Department:</b> " & Request("Department") & "<br>"
txtBody = txtBody & "<b>Priority:</b> " & Request("Priority") & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;(1 being the highest to 5 being the lowest) " & "<br>"
txtBody = txtBody & "<b>Due Date:</b> " & Request("DueDate") & "<br>"
txtBody = txtBody & "<font color=red>Remember to give at least 10 business days notice for any <a href= project/initiative</a> change requests.</font> " & "<br>"
txtBody = txtBody & "<b>Request Type:</b> " & Request("RequestType") & "<br>"
txtBody = txtBody & "<b>Site Name:</b> " & Request("Site") & "<br>"
txtBody = txtBody & "<b>Site Code Translation:</b> " & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;-1 = None Selected " & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 = The HR Employee Site " & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 = HR Tool Kit for Managers " & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 = HR Tool Kit" & "<br>"
txtBody = txtBody & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4 = HR Dashboard" & "<br>"
txtBody = txtBody & "<b>Section Name:</b> " & Request("site_selection") & "<br>"
txtBody = txtBody & "<b>URL:</b> " & "<a href=>" & Request("urla") & "</a>" & "<br>"
txtBody = txtBody & "<br>"
txtBody = txtBody & "<b>Description or Special Instructions:</b> " & Request("Desc") & "<br>"
txtBody = txtBody & "<br>"
txtBody = txtBody & "If you are faxing in the changes: " & Request("Fax")
txtBody = txtBody & " please fax to (916) 350-8832. " & "<br></font>"
mySmartMail.Body = txtBody

' Send the message
' ****************
mySmartMail.SendMail

if err.number <> 0 then

response.write("Error n° " & err.number - vbobjecterror & " = " & err.description & "<br>")

else

' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")


end if

set mySmartMail = nothing

%>

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>HR Web Team Online Request Form Confirmation</title>
<link rel="stylesheet" type="text/css" href="_private/bsc2003.css">
</head>

<body bgcolor="#FFFFFF">

<p><font face="Arial" size="2">Your form has been successfully submitted.<br><br>
Thank you for submitting your HR Web Team Request. The HR Web Team will review your request and will contact you regarding the status.<br>
<br>
If you are planning an e-mail communication in conjunction with your requested changes, please contact the HR Web Team via
<a href="mailto:hr.webrequests@blueshieldca.com">e-mail</a>.<br>
<br>
This page will re-direct back to the HR Web Team Online Request Form.</font><p>
<!--webbot bot="HTMLMarkup" startspan --><META HTTP-EQUIV="Refresh" CONTENT="5;URL=../hrweb_request.htm"><!--webbot bot="HTMLMarkup" endspan --></p>
</body>
</html>





Thanks!
 
Hi!, i dont know if I undestood you well but here if what I should do

If (strbucket ="HR Contacts") Then
if Request("Sender")<>"linda.moulton@blueshieldca.com" then
mySmartMail.CCs.Add "linda.moulton@blueshieldca.com"
' "debbie.navarro@blueshieldca.com"
end if
End If

and so on with the other CC's
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top