OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Send email using CDO

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Send email using CDO
Page: [1]
 
 
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
%>

(in reply to vqitinc)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Send email using CDO
Page: [1]
Jump to: 1





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