|
| |
|
|
vqitinc
Posts: 72 Joined: 11/14/2006 From: California Status: offline
|
Send email using CDO - 3/5/2009 9:25:01
I have an update query to update a SQL database that works great. Here is the code:
fp_sQry="UPDATE Shpmt SET AssignedStatus = 'Assigned', PickupDate = '::PickupDate::', DeliveryDate = '::DeliveryDate::', ModifiedDate = GetDate(), UserID = " & Session("UserID") & ", Contractor = '" & Session("x_Firstname") & " " & Session("x_Lastname") & "' WHERE IDShpmt = ::IDShpmt::"
I would also like to send an email using CDO and this also works great. Here is the code:
Dim strMessage
strMessage = strMessage & "Shipment = " & Request.Form("IDShpmt") & vbCrLf
strMessage = strMessage & "Pickup Date = " & Request.Form("PickupDate") & vbCrLf
strMessage = strMessage & "Delivery Date = " & Request.Form("DeliveryDate") & vbCrLf
strMessage = strMessage & "Status = " & Request.Form("Status") & vbCrLf
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Contractor Has Accepted Shipment"
myMail.From="admin@schafercb.com"
myMail.To="abrowning@visionquestit.com"
myMail.TextBody= strMessage
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="mail.visionquestit.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>
My issue is that I need to include the sesion data from the update query: Contractor = '" & Session("x_Firstname") & " " & Session("x_Lastname") & " In the email. All the other regular fields work. Any healp would be much appreciated.
|
|
|
|
vqitinc
Posts: 72 Joined: 11/14/2006 From: California Status: offline
|
RE: Send email using CDO - 3/5/2009 15:02:17
I figured it out:
<%
Dim strMessage
strMessage = strMessage & "Shipment: " & Request.Form("IDShpmt") & " has been accepted." & vbCrLf
strMessage = strMessage & vbCrLf
strMessage = strMessage & "The shipment has been assigned to: " & Session("x_Firstname") & " " & Session("x_Lastname") & vbCrLf
strMessage = strMessage & vbCrLf
strMessage = strMessage & "Shipment Details:" & vbCrLf
strMessage = strMessage & vbCrLf
strMessage = strMessage & "Pickup Date: " & Request.Form("PickupDate") & vbCrLf
strMessage = strMessage & "Delivery Date: " & Request.Form("DeliveryDate") & vbCrLf
strMessage = strMessage & "Shipment Status: " & Request.Form("Status") & vbCrLf
strMessage = strMessage & "Origin City: " & Request.Form("OCity") & vbCrLf
strMessage = strMessage & "Origin State: " & Request.Form("OState") & vbCrLf
strMessage = strMessage & "Destination City: " & Request.Form("DCity") & vbCrLf
strMessage = strMessage & "Destination State: " & Request.Form("DState") & vbCrLf
strMessage = strMessage & "Hold Status: " & Request.Form("HoldStatus") & vbCrLf
strMessage = strMessage & "Hold Reason: " & Request.Form("HoldReason") & vbCrLf
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Contractor Has Accepted Shipment"
myMail.From="admin@schafercb.com"
myMail.To="abrowning@visionquestit.com"
myMail.TextBody= strMessage
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="mail.visionquestit.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|