Home  >  Article  >  php教程  >  outlook发送邮件:PHP 发送 outlook 约会邮件

outlook发送邮件:PHP 发送 outlook 约会邮件

WBOY
WBOYOriginal
2016-06-21 08:50:131143browse
<ol class="dp-c">
<li class="alt"><span><span><?php  </span></span></span></li>
<li><span><span class="vars">$to</span><span> = </span><span class="string">"other@xxxx.net"</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$from</span><span> = </span><span class="string">"me@xxxx.net"</span><span>; </span></span></li>
<li><span><span class="vars">$subj</span><span> = </span><span class="string">"my test subject"</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$msg</span><span> = </span><span class="string">"this is the email body"</span><span>; </span></span></li>
<li><span><span class="vars">$header</span><span> = </span><span class="string">"From: "</span><span> . </span><span class="vars">$from</span><span> . </span><span class="string">"\r\n"</span><span> . </span></span></li>
<li class="alt"><span><span class="string">"MIME-Version: 1.0\r\n"</span><span> . </span></span></li>
<li><span><span class="string">"Content-Type: text/calendar;method=REQUEST"</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$txt_msg</span><span> = </span><span class="string">"this is my text message, to be attached\r\n"</span><span> . </span></span></li>
<li><span><span class="string">"not much to it, eh."</span><span>; </span></span></li>
<li class="alt"><span><span class="comment">//Various ways to creat a new, random UID</span><span> </span></span></li>
<li><span><span class="vars">$cal_uid</span><span> = </span><span class="string">"{"</span><span> . uniqid(mt_rand(), true) . </span><span class="string">"}"</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$cal_uid</span><span> = </span><span class="string">"{"</span><span> . </span><span class="func">date</span><span>(</span><span class="string">'Ymd'</span><span>).</span><span class="string">'T'</span><span>.</span><span class="func">date</span><span>(</span><span class="string">'His'</span><span>).</span><span class="string">"-"</span><span>.rand().</span><span class="string">"@mydomain.com}"</span><span>; </span></span></li>
<li><span><span class="vars">$cal_uid</span><span> = com_create_guid(); </span></span></li>
<li class="alt"><span><span class="vars">$cal_msg</span><span> = </span></span></li>
<li><span>"BEGIN:VCALENDAR </span></li>
<li class="alt"><span>PRODID:-<span class="comment">//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN</span><span> </span></span></li>
<li><span>VERSION:2.0 </span></li>
<li class="alt"><span>METHOD:REQUEST </span></li>
<li><span>BEGIN:VEVENT </span></li>
<li class="alt"><span>ORGANIZER:MAILTO:name </span></li>
<li><span>DTSTART:20090901T170000Z </span></li>
<li class="alt"><span>DTEND:20090901T035959Z </span></li>
<li><span>UID:<span class="string">" . $cal_uid . "</span><span> </span></span></li>
<li class="alt"><span>LOCATION:my meeting location </span></li>
<li><span>TRANSP:OPAQUE </span></li>
<li class="alt"><span>SEQUENCE:0 </span></li>
<li><span>DTSTAMP:20060309T045649Z </span></li>
<li class="alt"><span>CATEGORIES:Meeting </span></li>
<li><span>DESCRIPTION:meeting description, line 1 of 2.\nline 2 of 2.\n\n </span></li>
<li class="alt"><span>SUMMARY:meeting subject </span></li>
<li><span>PRIORITY:5 </span></li>
<li class="alt"><span>X-MICROSOFT-CDO-IMPORTANCE:1 </span></li>
<li><span>CLASS:PUBLIC </span></li>
<li class="alt"><span>BEGIN:VALARM </span></li>
<li><span>TRIGGER:-PT3D </span></li>
<li class="alt"><span>ACTION:DISPLAY </span></li>
<li><span>DESCRIPTION:Reminder </span></li>
<li class="alt"><span><span class="func">END</span><span>:VALARM </span></span></li>
<li><span>BEGIN:VTIMEZONE </span></li>
<li class="alt"><span>TZID:US/Central </span></li>
<li><span><span class="func">END</span><span>:VTIMEZONE </span></span></li>
<li class="alt"><span><span class="func">END</span><span>:VEVENT </span></span></li>
<li><span><span class="func">END</span><span>:VCALENDAR"; </span></span></li>
<li class="alt"><span><span class="keyword">if</span><span> (mail(</span><span class="vars">$to</span><span>, </span><span class="vars">$subj</span><span>, </span><span class="vars">$cal_msg</span><span>, </span><span class="vars">$header</span><span>, </span><span class="string">""</span><span>)) { </span></span></li>
<li><span><span class="func">echo</span><span> </span><span class="string">"test email sent"</span><span>; </span></span></li>
<li class="alt"><span>} <span class="keyword">else</span><span> { </span></span></li>
<li><span><span class="func">echo</span><span> </span><span class="string">"test email failed"</span><span>; </span></span></li>
<li class="alt"><span>} </span></li>
<li><span>?>  </span></li>
</ol>
本文链接http://www.cxybl.com/html/wlbc/Php/20130319/37246.html



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn