MailKit For VFP9 V1.0
* MailKit For VFP9 V1.0* Common SMTP Server Configuration
* Service provider SMTP server Port Encryption Method
* Gmail smtp. 587 StartTls
* Outlook smtp. 587 StartTls
* QQ smtp. 465 SslOnConnect
* 126 stmp. 25 StartTls
* SecureSocketOptions
* None = 0 No SSL or TLS encryption should be used.
* Auto = 1 Allow the MailKit.IMailService to decide which SSL or TLS options to use (default).;
If the server does not support SSL or TLS, then the connection will continue;
without any encryption.
* SslOnConnect = 2 The connection should use SSL or TLS encryption immediately.
* StartTls = 3 Elevates the connection to use TLS encryption immediately after reading the greeting;
and capabilities of the server. If the server does not support the STARTTLS extension,;
then the connection will fail and a System.NotSupportedException will be thrown.
* StartTlsWhenAvailable = 4 Elevates the connection to use TLS encryption immediately after reading the greeting;
and capabilities of the server, but only if the server supports the STARTTLS;
extension.
* SMTP Asynchronous Email Sending Method
*SendEmailAsync( string FromEmail ;
, string ToEmail ;
, string Subject ;
, string HtmlBody ;
, string TextBody ;
, SecureSocketOptions socketOptions ;
, string Attachments = "" )
* Events
* OnSendEmail( bool Success , string Message )
* Synchronize Sending Emails
* Bool SendEmail(string FromEmail ;
, string ToEmail ;
, string Subject ;
, string HtmlBody ;
, string TextBody ;
, SecureSocketOptions socketOptions ;
, string Attachments = "" ;
, string @ErrorMsg)
* STMP Considerations
* Port and encryption method: Common combinations include 587 + StartTLS or 465 + SSL/TLS.
* Authentication failed: Some email services (such as Gmail) require the activation of "Application-specific password" or "Low-security application access".
* Attachment path: Ensure that the file exists and you have read permissions.
* If attachments are large, use asynchronous sending to avoid blocking current business operations. After the command is sent,;
the system enters an asynchronous processing state. Once the sending is completed, the event OnSendEmail will be triggered for notification, ;
where Success = true indicates that your send command was successfully processed.
[此贴子已经被作者于2025-2-23 00:09编辑过]