Hola Yogesh
Tu codigo me funciono perfecto, pero tengo un problema..la cita se
envia...pero no se añade al calendario por defecto. En el gmail o el
outlook del destinatario sale el siguiente mensaje: "No se encuentra la
reunión en el calendario".
El sábado, 10 de octubre de 2009 05:28:08 UTC-5, Yogesh Dige escribió:
> SmtpClient sc = new SmtpClient();
> MailMessage msg = new MailMessage();
> msg.From = new MailAddress("[email protected]", "Yogesh Dige");
> msg.To.Add(new MailAddress("[email protected]", "Your Name"));
> msg.Subject = "Send Calendar Appointment Email";
> msg.Body = "Here is the Body Content";
>
> StringBuilder str = new StringBuilder();
> str.AppendLine("BEGIN:VCALENDAR");
> str.AppendLine("PRODID:-//SendMail");
> str.AppendLine("VERSION:2.0");
> str.AppendLine("METHOD:REQUEST");
> str.AppendLine("BEGIN:VEVENT");
> str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}",
> startTime));
> str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}",
> DateTime.UtcNow));
> str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endTime));
> str.AppendLine("LOCATION: Dubai");
> str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
> str.AppendLine(string.Format("DESCRIPTION:{0}", msg.Body));
> str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}",
> msg.Body));
> str.AppendLine(string.Format("SUMMARY:{0}", msg.Subject));
> str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}",
> msg.From.Address));
>
> str.AppendLine(string.Format("ATTENDEE;CN=\"{0}\";RSVP=TRUE:mailto:
> {1}", msg.To[0].DisplayName, msg.To[0].Address));
>
> str.AppendLine("BEGIN:VALARM");
> str.AppendLine("TRIGGER:-PT15M");
> str.AppendLine("ACTION:DISPLAY");
> str.AppendLine("DESCRIPTION:Reminder");
> str.AppendLine("END:VALARM");
> str.AppendLine("END:VEVENT");
> str.AppendLine("END:VCALENDAR");
> System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/
> calendar");
> ct.Parameters.Add("method", "REQUEST");
> AlternateView avCal = AlternateView.CreateAlternateViewFromString
> (str.ToString(), ct);
> msg.AlternateViews.Add(avCal);
>
> sc.Send(msg);
>
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net