Load-message-from-eml-file-and-send-it - 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] **

Load message from eml file and send it
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 conenction
    wodSMTP.Blocking = True
    
    ' Connect to your SMTP server
    wodSMTP.Connect

    ' Load already created message
    wodSMTP.Message.Load "C:\message.eml"
    
    ' Finally, send the message.
    wodSMTP.SendMessage
    
    ' Since we're done, disconnect from server
    wodSMTP.Disconnect

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()

    ' Load already created message
    wodSMTP.Message.Load("C:\message.eml")
    
    'Finally, send the message.
    wodSMTP.SendMessage()
    
    ' Since we're done, disconnect from server
    wodSMTP.Disconnect()

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();

    // Load already created message
    wodSMTP.Message.Load("C:\\message.eml");
    
    // Finally, send the message.
    wodSMTP.SendMessage();
    
    // Since we're done, disconnect from server
    wodSMTP.Disconnect();
}