Class Mailer
- Namespace
- ZapLib
- Assembly
- ZapLib.dll
SMTP 郵件發送工具
public class Mailer
- Inheritance
-
Mailer
- Inherited Members
Constructors
Mailer(string, string, string, int, bool, int)
建構子,初始化必要 SMTP 物件
public Mailer(string MAIL_HOST, string MAIL_ACT, string MAIL_PWD, int MAIL_PORT = 587, bool MAIL_SSL = true, int MAIL_RETRY = 1)
Parameters
MAIL_HOSTstringSMTP Server 位置
MAIL_ACTstring登入帳號
MAIL_PWDstring登入密碼
MAIL_PORTintSMTP Server 埠號
MAIL_SSLbool是否啟用 SSL
MAIL_RETRYint是否啟用失敗重寄機制,預設為啟用
Properties
AttachmentsList
郵件的附件列表
public List<MimePart> AttachmentsList { get; }
Property Value
- List<MimePart>
ErrMsg
錯誤訊息
public string ErrMsg { get; }
Property Value
SecureSocketOption
使用連線的加密協議
public SecureSocketOptions SecureSocketOption { get; set; }
Property Value
- SecureSocketOptions
EMAIL 物件
public MimeMessage mail { get; set; }
Property Value
- MimeMessage
smtp
SMTP 連線物件
public SmtpClient smtp { get; set; }
Property Value
- SmtpClient
Methods
AddAttachments(string)
新增郵件附加檔案,回傳檔案的 content id
public string AddAttachments(string path)
Parameters
pathstring檔案實體路徑,如果檔案不存在則回傳 null
Returns
- string
檔案的 content id
Send(string, string, string, string, string, string[])
送出郵件
public bool Send(string to, string subject, string body, string cc = null, string bcc = null, string[] attchments = null)
Parameters
tostring發送到指定 email 位置,多個用逗號隔開
subjectstring信件主旨
bodystring信件內文
ccstring副本 (不需要可傳 NULL)
bccstring密件副本 (不需要可傳 NULL)
attchmentsstring[]附加檔案