SmtpClient.SmtpConversation Property


Gets the latest smtp conversation between smtp server and smtp client.

[Visual Basic]
Public Property SmtpConversation As String
[C#]
public string SmtpConversation {get;}
[C++]
public: __property String^ get_SmtpConversation();
[JScript]
public function get SmtpConversation() : String;

Property Value

A string that logs the latest smtp conversation between smtp server and smtp client.

Example

[Visual Basic, C#, C++] To get the full samples of EASendMail, please refer to Samples section.

[VB - Send Email]

Imports EASendMail

Sub SendMail()
    Dim oSmtp As SmtpClient = New SmtpClient
    Try
        Dim oMail As SmtpMail = New SmtpMail("TryIt")
        oMail.From = New MailAddress("from@adminsystem.com")
        oMail.To.Add(New MailAddress("to@adminsystem.com"))

        oMail.Subject = "test subject"
        oMail.TextBody = "test body"
        
        oSmtp.SendMail(Nothing, oMail)
        
        Console.WriteLine("The message was sent to {0} successfully", 
                    oSmtp.CurrentSmtpServer.Server)

    Catch exp As System.Exception
        Console.WriteLine("Exception: {0}", exp.Message)
    End Try

    Console.WriteLine("SMTP LOG:" & vbCrLf);
    Console.WriteLine(oSmtp.SmtpConversation)
End Sub


[C# - Send Email] using System; using EASendMail; void SendMail() { SmtpClient oSmtp = new SmtpClient(); try { SmtpMail oMail = new SmtpMail("TryIt"); oMail.From = new MailAddress("from@adminsystem.com" ); oMail.To.Add( new MailAddress("to@adminsystem.com" )); oMail.Subject = "test subject"; oMail.TextBody = "test body"; oSmtp.SendMail(null, oMail); Console.WriteLine("The message was sent to {0} successfully", oSmtp.CurrentSmtpServer.Server); } catch( System.Exception exp ) { Console.WriteLine( "Exception: {0}", exp.Message ); } Console.WriteLine("SMTP LOG:\r\n"); Console.WriteLine(oSmtp.SmtpConversation); }
[C++/CLI - Send Email] using namespace System; using namespace EASendMail; void SendMail() { SmtpClient ^oSmtp = gcnew SmtpClient(); try { SmtpMail ^oMail = gcnew SmtpMail("TryIt"); oMail->From = gcnew MailAddress("from@adminsystem.com"); oMail->To->Add( gcnew MailAddress("to@adminsystem.com")); oMail->Subject = "test subject"; oMail->TextBody = "test body"; oSmtp->SendMail(NULL, oMail); Console::WriteLine("The message was sent to {0} successfully", oSmtp->CurrentSmtpServer->Server); } catch(Exception ^exp) { Console::WriteLine("Exception: Common: {0}", exp->Message); } Console::WriteLine("SMTP LOG:\r\n"); Console::WriteLine(oSmtp->SmtpConversation); }

See Also

SmtpClient.LogFileName Property