Online Shopping : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 19 people (68%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How do I send an iCalendar request via email using ASP and/or IIS?

Nov 24th, 2006 07:22
Christopher Gardiner, Steve Evans, Matthew Glidden,


The answer to this question is almost identical to the answer for an 
earlier iCab question.
http://www.faqts.com/knowledge_base/view.phtml/aid/2023/fid/202
Once you've created the ICS file for a calendar event, you can create 
and send emails from a remote mail server using the CD0 object, 
attaching the ICS file you just created. Be careful to remove line 
breaks created by this site. Each objMessage.Configuration.Fields.Item 
should be on one line.
dim strTo
dim strFrom
dim strFromName
dim strSubject
dim headers
dim strMessage
dim varName
dim varValue
dim strSMTPServer
dim strSMTPUsername
dim strSMTPPassword
dim strMSSchemas
dim objMessage
'SMTP Authentication Setup
strSMTPServer = "mail.yourmicrosoftmailserver.com"
strSMTPUsername = "[email protected]"
strSMTPPassword = "yourpassword"
Set objMessage = CreateObject("CDO.Message") 
'Congure the SMTP setting
strMSSchemas = "http://schemas.microsoft.com/cdo/configuration/"
objMessage.Configuration.Fields.Item(strMSSchemas & "sendusing") = 2
objMessage.Configuration.Fields.Item(strMSSchemas & "smtpserver") = 
strSMTPServer
objMessage.Configuration.Fields.Item(strMSSchemas 
& "smtpauthenticate") = 1
objMessage.Configuration.Fields.Item(strMSSchemas & "sendusername") = 
strSMTPUsername
objMessage.Configuration.Fields.Item(strMSSchemas & "sendpassword") = 
strSMTPPassword
objMessage.Configuration.Fields.Item(strMSSchemas & "smtpserverport") 
= 25 
objMessage.Configuration.Fields.Item(strMSSchemas & "smtpusessl") = 
False
objMessage.Configuration.Fields.Item(strMSSchemas 
& "smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
'Populate the Message
strTo = "[email protected]"
strFrom = "[email protected]"
strFromName = "Sender Alias (Nickname)"
strSubject = "Subject Here"
strMessage = "Message Body Here" & vbCrLf
strMessage = strMessage & "Message Body Paragraph 2" & vbCrLf
'Actually send the e-mail
objMessage.Subject = strSubject
objMessage.From = """" & strFromName & """ <" & strFrom & ">"
objMessage.To = strTo
objMessage.TextBody = strMessage
objMessage.AttachFile(icsFile)
objMessage.Send
Set objMessage = Nothing



© 1999-2004 Synop Pty Ltd