Send-a-simple-Email-with-Attachment-using-Smarthost - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Send a simple E-Mail with attachment using Smarthost
VB code
Dim wodSMTP As wodSmtpCom
Private Sub Form_Load()
    Set wodSMTP = New wodSmtpCom

    ' Set connection parameters
    wodSMTP.HostName = "your_smtp_server_address"
    wodSMTP.Login = "your_login"
    wodSMTP.Password = "your_password"
    
    ' Use Username/Password Authentication
    wodSMTP.Authentication = AuthLogin
    
    ' Use synchronous connection
    wodSMTP.Blocking = True
    
    ' Connect to your SMTP server
    wodSMTP.Connect

    ' Create and send message
    wodSMTP.SendSimpleAttachment "sender@email.com", "recipient@email.com", "This is subject.", "This is what this e-mail is about.", "C:\Attachment.ext"

End Sub
VB.Net code
Dim wodSMTP As WODSMTPCOMLib.wodSmtpCom
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    wodSMTP = New WODSMTPCOMLib.wodSmtpCom

    ' Set connection parameters
    wodSMTP.Hostname = "your_smtp_server_address"
    wodSMTP.Login = "your_login"
    wodSMTP.Password = "your_password"

    ' Use Username/Password Authentication
    wodSMTP.Authentication = WODSMTPCOMLib.SmtpAuthentications.AuthLogin

    ' Use synchronous connection
    wodSMTP.Blocking = True

    ' Connect to your SMTP server
    wodSMTP.Connect()

    ' Create and send message
    wodSMTP.SendSimpleAttachment("sender@email.com", "recipient@email.com", "This is subject.", "This is what this e-mail is about.", "C:\Attachment.ext")

End Sub
C# code
private WODSMTPCOMLib.wodSmtpCom wodSMTP;
private void Form1_Load(object sender, EventArgs e)
{
    wodSMTP = new WODSMTPCOMLib.wodSmtpCom();

    // Set connection parameters
    wodSMTP.Hostname = "your_smtp_server_address";
    wodSMTP.Login = "your_login";
    wodSMTP.Password = "your_password";

    // Use Username/Password Authentication
    wodSMTP.Authentication = WODSMTPCOMLib.SmtpAuthentications.AuthLogin;

    // Use synchronous connection
    wodSMTP.Blocking = true;

    // Connect to your SMTP server
    wodSMTP.Connect();

    // Create and send message
    wodSMTP.SendSimpleAttachment("sender@email.com", "recipient@email.com", "This is subject.", "This is what this e-mail is about.", "C:\\Attachment.ext");
}