Just a fyi for those needing to obey the new USA timezone rules that go into effect March 2007, there is a new update of aspNetEmail that obeys these rules.
There are 2 ways you can deal with the new USA timezone rules.
you can:
1) Download the updated version of aspNetEmail from
http://www.advancedintellect.com/page.aspx?cn=buildupdates and it will handle them automatically
or
2)Code a work-around that creates your own timezone rules. Below is a code example that demonstrates this:
[C#]
private static void DSTChangeExample()
{
iCalendar ical = new iCalendar( "100 main", "Status update", "everyone update about current project", new DateTime( 2007, 6, 5, 11, 0, 0 ), new DateTime( 2007, 6, 5, 12,0,0 ), iCalendarType.iCal );
//let's override aspNetEmail's TimeZone rules, to match the new USA DST changes
//set the timezone id
ical.TimeZone.Id = "(GMT-05.00) Eastern Time (US & Canada)";
//create the STANDARD timezone with rules:
//BEGIN:STANDARD
//DTSTART:16010101T020000
//TZOFFSETFROM:-0400
//TZOFFSETTO:-0500
//RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
//END:STANDARD
TimeZoneRule standard = new TimeZoneRule();
standard.BeginLabel = "BEGIN:STANDARD";
standard.DTStart = "16010101T030000";
standard.TZOffsetFrom = "-0400";
standard.TZOffsetTo = "-0500";
standard.RRule = "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU";
standard.EndLabel = "END:STANDARD";
//create the DAYLIGHT timezone with rules:
//BEGIN:DAYLIGHT
//DTSTART:16010101T020000
//TZOFFSETFROM:-0500
//TZOFFSETTO:-0400
//RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
//END:DAYLIGHT
TimeZoneRule daylight = new TimeZoneRule();
daylight.BeginLabel = "BEGIN:DAYLIGHT";
daylight.DTStart = "16010101T020000";
daylight.TZOffsetFrom = "-0500";
daylight.TZOffsetTo = "-0400";
daylight.RRule = "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU";
daylight.EndLabel = "END:DAYLIGHT";
//add the rules
ical.TimeZone.AddTimeZoneRule( standard );
ical.TimeZone.AddTimeZoneRule( daylight );
ical.TimeZone.Format = TimeZoneFormat.TimeZoneCustomRules;
//add in the orgianizer and attendees
//ical.Event.Organizer.. = ...
//ical.Event.Attendees.Add(...);
//ical.Event.Sequence
EmailMessage m = new EmailMessage( "127.0.0.1" );
m.From = "me@example.com";
m.To = "you@example.com";
m.Subject = "ical test";
m.AddCalendar( ical );
m.Send();
}
[VB.NET]
Private Shared Sub DSTChangeExample()
Dim ical As New iCalendar("100 main", "Status update", "everyone update about current project", New DateTime(2007, 6, 5, 11, 0, 0), New DateTime(2007, 6, 5, 12, 0, 0), iCalendarType.iCal)
'let's override aspNetEmail's TimeZone rules, to match the new USA DST changes
'set the timezone id
ical.TimeZone.Id = "(GMT-05.00) Eastern Time (US & Canada)"
'create the STANDARD timezone with rules:
'BEGIN:STANDARD
'DTSTART:16010101T020000
'TZOFFSETFROM:-0400
'TZOFFSETTO:-0500
'RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
'END:STANDARD
Dim standard As New TimeZoneRule()
standard.BeginLabel = "BEGIN:STANDARD"
standard.DTStart = "16010101T030000"
standard.TZOffsetFrom = "-0400"
standard.TZOffsetTo = "-0500"
standard.RRule = "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU"
standard.EndLabel = "END:STANDARD"
'create the DAYLIGHT timezone with rules:
'BEGIN:DAYLIGHT
'DTSTART:16010101T020000
'TZOFFSETFROM:-0500
'TZOFFSETTO:-0400
'RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
'END:DAYLIGHT
Dim daylight As New TimeZoneRule()
daylight.BeginLabel = "BEGIN:DAYLIGHT"
daylight.DTStart = "16010101T020000"
daylight.TZOffsetFrom = "-0500"
daylight.TZOffsetTo = "-0400"
daylight.RRule = "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU"
daylight.EndLabel = "END:DAYLIGHT"
'add the rules
ical.TimeZone.AddTimeZoneRule(standard)
ical.TimeZone.AddTimeZoneRule(daylight)
ical.TimeZone.Format = TimeZoneFormat.TimeZoneCustomRules
'add in the orgianizer and attendees
'ical.Event.Organizer.. = ...
'ical.Event.Attendees.Add(...);
'ical.Event.Sequence
Dim m As New EmailMessage("127.0.0.1")
m.From = "me@example.com"
m.To = "you@example.com"
m.Subject = "ical test"
m.AddCalendar(ical)
m.Send()
End Sub
Cheers!
Dave
|