zoukankan      html  css  js  c++  java
  • 发送邮件

    发送邮件

    Public Function SendMail(ByVal iSMTPServer As String, ByVal iUser As String, ByVal iPass As String, ByVal iAddressto As String, ByVal iAddressFrom As String, ByVal iSubject As String, ByVal iBody As String, Optional ByVal iFileName As String = "") As String On Error GoTo ERR_PROC Dim plReturn As String = String.Empty Dim plAttach As System.Net.Mail.Attachment = Nothing '送信元、送信先メールアドレスの設定。 Dim vlMessage As New System.Net.Mail.MailMessage(iAddressFrom, iAddressto) If File.Exists(iFileName) Then plAttach = New System.Net.Mail.Attachment(iFileName) End If 'メール設定 'メールの件名。 vlMessage.Subject = iSubject 'メールの内容。本文。 vlMessage.Body = iBody If File.Exists(iFileName) Then vlMessage.Attachments.Add(plAttach) End If 'SmtpClientに、サーバとポート番号を指定。 Dim vlClient As New System.Net.Mail.SmtpClient(iSMTPServer) 'SMTPサーバの認証IDとパスワードを設定した場合のみ、SMTP認証を行う。 If iUser <> "" And iPass <> "" Then vlClient.Credentials = New System.Net.NetworkCredential(iUser, iPass) End If 'メールを送信します。 vlClient.Send(vlMessage) EXIT_PROC: If plAttach IsNot Nothing Then plAttach.Dispose() plAttach = Nothing End If If vlMessage IsNot Nothing Then vlMessage.Dispose() vlMessage = Nothing End If Return plReturn Exit Function
  • 相关阅读:
    对Spring <context:annotation-config/>的理解
    Javascript this指针
    go 打造世界最快的go模板引擎gorazor 2.0
    swagger 部署(Mac )
    Ab测试
    Nginx tcp限制并发、IP、记日志
    Nginx proxy_protocol协议与realip模块
    数据结构之回溯
    数据结构之分治
    数据结构之二分查找
  • 原文地址:https://www.cnblogs.com/jiningning/p/4735877.html
Copyright © 2011-2022 走看看