当前位置:去回答>生活百科>用VB怎样实现发送邮件功能?

用VB怎样实现发送邮件功能?

2024-10-27 13:55:51 编辑:join 浏览量:521

用VB怎样实现发送邮件功能?

用这个方法可以不通过OutLook 直接用 vb 发送邮件: \'Wait 为延时你可用API或自己做!不延时时发送可能不成功的! \'strFrom :谁发的 \'strTo :发给谁 \'strSubject :主题 \'strBody :内容 \'wsk : Winsock控件 Public Sub SendMail(strFrom As String, strTo As String, strSubject As String, strBody As String, wsk As Winsock) Dim intCount As IntegerWait 0.5 wsk.SendData "EHLO " & wsk.LocalIP & vbCrLf wsk.SendData "MAIL FROM:" & strFrom & vbCrLfWait 0.5 wsk.SendData "RCPT TO:" & strTo & vbCrLf wsk.SendData "DATA" & vbCrLfWait 0.5 wsk.SendData "MIME-Version: 1.0" & vbCrLf wsk.SendData "From: " & ExtractArgument(1, strFrom, "@") & " <" & strFrom & ">" & vbCrLf wsk.SendData "To: <" & strTo & ">" & vbCrLf wsk.SendData "Subject: " & strSubject & vbCrLf wsk.SendData "Content-Type: multipart/mixed;" & vbCrLf wsk.SendData " boundary=Unique-Boundary" & vbCrLf & vbCrLf wsk.SendData " [ Random garbage here ]" & vbCrLf & vbCrLf wsk.SendData vbCrLf & "--Unique-Boundary" & vbCrLf wsk.SendData "Content-type: text/plain; charset=US-ASCII" & vbCrLf & vbCrLf wsk.SendData strBody & vbCrLf & vbCrLf wsk.SendData vbCrLf & "." & vbCrLfWait 0.5

标签:VB,邮件,发送

版权声明:文章由 去回答 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.quhuida.com/life/319260.html
热门文章