通过电子邮件通知将约会添加到您的日历

发布于 2024-12-23 12:36:47 字数 173 浏览 3 评论 0原文

我需要一个通过电子邮件将事件添加到我的日历的示例。例如,当我向客户发送有关他们的约会的电子邮件时,我希望他们在电子邮件中有一个选项,允许他们只需单击按钮或其他东西即可在日历上添加活动。

有人可以指导我做什么吗?

我需要这个主要是为了将它与 Coldfusion 9 一起使用。

谢谢!

I need an example for adding events to my calendars through emails. For example when I send an email to my clients regarding their appointment, i want them to have an option in the email that will allow them to add the event on their calendar by just clicking on a button or something.

Is there anything out there that someone can direct me to it?

I need this mainly to use it with coldfusion 9.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青芜 2024-12-30 12:36:47

我推荐来自 http://www.cflib.org/ 的 iCalUs UDF udf/icalus

WebDH 提供了一个很好的例子此处

这是一个使用 CF9 的示例,我很快将其组合在一起,但尚未进行测试。

<cfscript>

    eventStr = {};
    eventStr.organizerName = "John Doe"; //Organizer Name
    eventStr.organizerEmail = "[email protected]"; //Organizer Email
    eventStr.startTime = ParseDateTime("12/30/2011 11:00"); //format: m/d/yyyy HH:mm OR h:mm TT -- this is Eastern time
    eventStr.subject = "Demo Example";
    eventStr.location = "StackOverflow.com";
    eventStr.description = "Example iCalendar using CF9";

    // Display in browser
    //pc = getpagecontext().getresponse();
    //pc.getresponse().setcontenttype('text/calendar');
    //pc.setHeader("Content-Disposition","inline;filename=newAppointment.ics");
    //writeOutput(iCalUS(eventStr));

    //Email
    m = new mail();
    m.setSubject( "Event" );
    m.setTo( "[email protected]" );
    m.setFrom( "[email protected]" );
    m.setServer( "localhost" );   
    //m.addParam( file="#ACCOUNT_TXT_FILE#" );
    m.addPart( type="text", charset="utf-8", wraptext="72", body="Attached is a calendar event..." );
    m.addPart( type="text/calendar" body="#iCalUS(eventStr)#");
    m.send();

</cfscript>

这是另一个示例参考 显示如何通过电子邮件发送日历事件。

I'd recommend the iCalUs UDF from http://www.cflib.org/udf/icalus

WebDH provides a great example here.

Here's an example using CF9 that I quickly put together but haven't tested yet.

<cfscript>

    eventStr = {};
    eventStr.organizerName = "John Doe"; //Organizer Name
    eventStr.organizerEmail = "[email protected]"; //Organizer Email
    eventStr.startTime = ParseDateTime("12/30/2011 11:00"); //format: m/d/yyyy HH:mm OR h:mm TT -- this is Eastern time
    eventStr.subject = "Demo Example";
    eventStr.location = "StackOverflow.com";
    eventStr.description = "Example iCalendar using CF9";

    // Display in browser
    //pc = getpagecontext().getresponse();
    //pc.getresponse().setcontenttype('text/calendar');
    //pc.setHeader("Content-Disposition","inline;filename=newAppointment.ics");
    //writeOutput(iCalUS(eventStr));

    //Email
    m = new mail();
    m.setSubject( "Event" );
    m.setTo( "[email protected]" );
    m.setFrom( "[email protected]" );
    m.setServer( "localhost" );   
    //m.addParam( file="#ACCOUNT_TXT_FILE#" );
    m.addPart( type="text", charset="utf-8", wraptext="72", body="Attached is a calendar event..." );
    m.addPart( type="text/calendar" body="#iCalUS(eventStr)#");
    m.send();

</cfscript>

Here's another example reference that shows how to email the calendar event.

顾挽 2024-12-30 12:36:47

这是 ICS 格式的一个非常基本的实现。它旨在通过浏览器进行访问,但更改为创建带有 ICS 扩展名的文本文件并通过电子邮件发送它是相当学术性的。

<cfheader name="Content-Disposition" value="attachment; filename=event.ics" />
<cfcontent reset="true" type="text/calendar" />
<cfscript>
// handle all-day events
if (NOT isDate(starttime) OR NOT isDate(endtime)) {
  dtstart=';VALUE=DATE:#dateFormat(eventdate,"yyyymmdd")#';
  dtend=';VALUE=DATE:#dateFormat(dateAdd("d",1,eventdate),"yyyymmdd")#';
} else {
  dtstart=';TZID="Eastern Standard Time":#dateFormat(eventdate,"yyyymmdd")#T#timeFormat(starttime,"HHmmss")#';
  dtend=';TZID="Eastern Standard Time":#dateFormat(eventdate,"yyyymmdd")#T#timeFormat(endtime,"HHmmss")#';
}
</cfscript>

<cfoutput>
BEGIN:VCALENDAR
PRODID:-//Company//Source//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Eastern Standard Time
BEGIN:STANDARD
DTSTART:16011104T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010311T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:#dateFormat(dateAdded,"yyyymmdd")#T#timeFormat(dateAdded,"HHmmss")#Z
DESCRIPTION:#desc#
DTEND#dtend#
DTSTAMP:#dateFormat(dateAdded,"yyyymmdd")#T#timeFormat(dateAdded,"HHmmss")#Z
DTSTART#dtstart#
LAST-MODIFIED:#dateFormat(dateApproved,"yyyymmdd")#T#timeFormat(dateApproved,"HHmmss")#Z
LOCATION:#location#
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:#title#
TRANSP:OPAQUE
UID:#dateFormat(now(),"yyyymmdd")#T#timeFormat(now(),"HHmmss")#Z@#uniqueID#
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
</cfoutput>

Here is a very basic implementation of the ICS format. This is designed to be accessed through a browser, but it'd be fairly academic to change to create a text file with ICS extension and send it via e-mail.

<cfheader name="Content-Disposition" value="attachment; filename=event.ics" />
<cfcontent reset="true" type="text/calendar" />
<cfscript>
// handle all-day events
if (NOT isDate(starttime) OR NOT isDate(endtime)) {
  dtstart=';VALUE=DATE:#dateFormat(eventdate,"yyyymmdd")#';
  dtend=';VALUE=DATE:#dateFormat(dateAdd("d",1,eventdate),"yyyymmdd")#';
} else {
  dtstart=';TZID="Eastern Standard Time":#dateFormat(eventdate,"yyyymmdd")#T#timeFormat(starttime,"HHmmss")#';
  dtend=';TZID="Eastern Standard Time":#dateFormat(eventdate,"yyyymmdd")#T#timeFormat(endtime,"HHmmss")#';
}
</cfscript>

<cfoutput>
BEGIN:VCALENDAR
PRODID:-//Company//Source//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Eastern Standard Time
BEGIN:STANDARD
DTSTART:16011104T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010311T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:#dateFormat(dateAdded,"yyyymmdd")#T#timeFormat(dateAdded,"HHmmss")#Z
DESCRIPTION:#desc#
DTEND#dtend#
DTSTAMP:#dateFormat(dateAdded,"yyyymmdd")#T#timeFormat(dateAdded,"HHmmss")#Z
DTSTART#dtstart#
LAST-MODIFIED:#dateFormat(dateApproved,"yyyymmdd")#T#timeFormat(dateApproved,"HHmmss")#Z
LOCATION:#location#
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:#title#
TRANSP:OPAQUE
UID:#dateFormat(now(),"yyyymmdd")#T#timeFormat(now(),"HHmmss")#Z@#uniqueID#
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
</cfoutput>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文