有人可以向我提供使用JMail发送会议邀请(与Outlook兼容)的代码段/功能(PHP或经典ASP)的完整/有效示例吗?
答案 0 :(得分:1)
以下是我在Classic ASP中为我的解决方案创建的用于创建日历文件的功能。
您必须自定义它。例如fmtDateTime& FmtDate是用于格式化日期的自定义函数。您需要使用自己的功能。 我还有一些硬编码的东西(例如发送应用程序名称,发送者名称和发送者电子邮件),但您可以轻松地制作这些参数。而且你也想设置合适的时区。
Function WriteICSFile(CalendarFileName,startdate,enddate,starttime,endtime,description,summary,venue)
If enddate = "" Then enddate = startdate
startdate = startdate & " " & starttime
enddate = enddate & " " & endtime
txtNow = fmtDateTime(now(),"yyyy-mm-dd hh:mm:ss")
txtNow = Replace(Replace(Replace(txtNow,"-","")," ","T"),":","")
txtStartDate=FmtDate(startdate,"%Y%M%DT%H%N00")
txtEndDate=FmtDate(enddate,"%Y%M%DT%H%N00")
Contents = "BEGIN:VCALENDAR" & vbCRLF &_
"VERSION:2.0" & vbCRLF &_
"PRODID:-//NAME OF SENDING APPLICATION//EN" & vbCRLF &_
"BEGIN:VEVENT" & vbCRLF &_
"UID:Event" & intEvents & vbCRLF &_
"DTSTAMP;TZID=Pacific/Auckland:" & txtNow & vbCRLF &_
"ORGANIZER;CN=SENDER NAME:MAILTO:SENDER EMAIL" & vbCRLF &_
"DTSTART;TZID=Pacific/Auckland:" & txtStartDate & vbCRLF &_
"DTEND;TZID=Pacific/Auckland:" & txtEndDate & vbCRLF &_
"DESCRIPTION:" & description & vbCRLF &_
"SUMMARY:" & summary & vbCRLF &_
"LOCATION:" & venue & vbCRLF &_
"END:VEVENT" & vbCRLF &_
"END:VCALENDAR" & vbCRLF
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(CalendarFileName, 2, True)
oTextFile.Write Contents
oTextFile.Close
set oTextFile = nothing
set oFS = nothing
End Function