program SendMailWithCalendarRequest; {$APPTYPE CONSolE} uses IDSMTP,Classes,DateUtils,IDMessage,SysUtils; procedure SendCalendarRequest; var SMTP : TIDSMTP; MailMessage : TIDMessage; begin SMTP:= TIDSMTP.Create(nil); MailMessage := TIDMessage.Create(nil); try SMTP.Host := 'smtp.mailserver.com'; SMTP.Port := 25; SMTP.Username := 'the account'; SMTP.Password := 'the password'; SMTP.AuthType := satDefault; MailMessage.From.Address := 'mail@server.com'; MailMessage.RecipIEnts.EMailAddresses := 'the RecipIEnt'; MailMessage.Subject := 'Send calendar'; MailMessage.Body.Add('BEGIN:VCALENDAR'); MailMessage.Body.Add('VERSION:1.0'); MailMessage.Body.Add('BEGIN:VEVENT'); MailMessage.Body.Add('ORGANIZER:MAILTO:'+SenderMail); MailMessage.Body.Add('DTStart:'+FormatDateTime('YYYY-DD-DD',Now)); MailMessage.Body.Add('DTEnd:'+FormatDateTime('YYYY-DD-DD',Tomorrow)); MailMessage.Body.Add('Location;ENCoding=QUOTED-PRINtable: My home'); MailMessage.Body.Add('UID:'+FormatDateTime('YYYY-DD-DD',Now)+FormatDateTime('YYYY-DD-DD',Tomorrow)); MailMessage.Body.Add('SUMMARY:Appointment Reminder'); MailMessage.Body.Add('DESCRIPTION:Test message'); MailMessage.Body.Add('PRIORITY:5'); MailMessage.Body.Add('END:VEVENT'); MailMessage.Body.Add('END:VCALENDAR'); MailMessage.ContentType := 'text/calendar'; SMTP.Connect; try try SMTP.Send(MailMessage) ; Writeln('OK') except on E:Exception do Writeln(0,'ERROR: ' + E.Message) ; end; finally SMTP.disconnect; end; finally SMTP.Free; MailMessage.Free; end; end; begin try SendCalendarRequest; readln; except on E: Exception do Writeln(E.Classname,': ',E.Message); end; end.总结
以上是内存溢出为你收集整理的delphi – 如何发送带有日历请求的电子邮件(内容类型:文本/日历)全部内容,希望文章能够帮你解决delphi – 如何发送带有日历请求的电子邮件(内容类型:文本/日历)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)