asp.net - How to Send Invite with Summary different from Email Subject -


sending invite using alternateview class

when sending email , invite using alternateview class invite description , summary equals email body , subject when hardcoded.

sending invite using attachment class

when invite sent attatchment text changed accordingly there no request information shown (image bellow).

enter image description here

i solve issue either alternateviews or attachment.

asp.net code

        //email message         mailaddress emailfrom = new mailaddress("from@email.com", "from email");         mailaddress emailto = new mailaddress("to@email.com", "to email");         mailmessage mymail = new mailmessage();         mymail.isbodyhtml = true;         mymail.from = emailfrom;         mymail.to.add(emailto);           //email subject , body         mymail.subject = "email subject";         mymail.body = "<h5>emaill description</5>";           //invite          stringbuilder str = new stringbuilder();         str.appendline("begin:vcalendar");         str.appendline("prodid:-//schedule meeting");         str.appendline("version:2.0");         str.appendline("method:request");         str.appendline("begin:vevent");         str.appendline(string.format("dtstart:{0:yyyymmddthhmmssz}", datetime.utcnow.adddays(5)));touniversaltime()));         str.appendline(string.format("dtstamp:{0:yyyymmddthhmmssz}", datetime.utcnow.touniversaltime()));         str.appendline(string.format("dtend:{0:yyyymmddthhmmssz}", datetime.utcnow.addhours(1).touniversaltime()));         str.appendline("location: brasil");         str.appendline(string.format("uid:{0}", guid.newguid()));         str.appendline(string.format("summary:{0}", "invite title"));         str.append(string.format("x-alt-desc;fmttype=text/html:{0}", "<h5>invite description html allowed</h5>") + environment.newline));         str.appendline(string.format("organizer:mailto:{0}", mymail.from.address));         str.appendline(string.format("attendee;cn=\"{0}\";rsvp=true:mailto:{1}", mymail.to[0].displayname, mymail.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");           smtpclient client = new smtpclient("relay.email.com");         contenttype contentype = new contenttype("text/calendar");         contentype.parameters.add("method", "request");         contentype.parameters.add("name", "invite.ics");          ////invite attatchment (uncomment test, don't forget comment alternateview)         //var calendarbytes = encoding.utf8.getbytes(str.tostring());         //memorystream ms = new memorystream(calendarbytes);         //system.net.mail.attachment attachment = new system.net.mail.attachment(ms, contentype);         //mymail.attachments.add(attachment);          //alternativeview inline         alternateview avcal = alternateview.createalternateviewfromstring(str.tostring(), contentype);         mymail.alternateviews.add(avcal);          //send email         client.send(mymail); 

invite sample

i've used validate invite body https://icalendar.org/validator.html

begin:vcalendar prodid:-//schedule meeting version:2.0 method:request begin:vevent dtstart:20170731t070000z dtstamp:20170725t145900z dtend:20170731t083000z duration: pt1h30m0s location: sede uid:5e85406c-b538-4bb7-851f-bfa5d343e318 summary: bananas x-alt-desc;fmttype=text/html:<h5>hello</h5> organizer:mailto:nelson.costa@email.com attendee;cn="";rsvp=true:mailto:nelssen@email.com begin:valarm trigger:-pt15m action:display description:reminder end:valarm end:vevent end:vcalendar 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -