I don't have a conversion of the 'MailMessage' or 'MailAddress' types, or 'Console.ReadKey', but I have a conversion that should help a bit:
public class Program
{
public static void main(String\[\] args)
{
try
{
// Check arguments
if (args.length != 3)
{
ShowUsage();
return;
}
// Create message
MailMessage mmMessage = new MailMessage();
mmMessage.To.add(new MailAddress((String)((args\[2\] instanceof String) ? args\[2\] : null)));
mmMessage.From = new MailAddress((String)((args\[1\] instanceof String) ? args\[1\] : null));
mmMessage.Subject = "TestMail";
mmMessage.Body = "This is a test";
// Send message
SmtpClient sc = new SmtpClient((String)((args\[0\] instanceof String) ? args\[0\] : null));
sc.Send(mmMessage);
}
catch (Throwable ex)
{
System.out.println(ex);
}
finally
{
//Pause
System.out.println();
System.out.print("Press a key >");
Console.ReadKey();
}
}
private static void ShowUsage()
{
System.out.println("Usage");
System.out.println("TestMail \[SmtpServer\] \[FromAddress\] \[ToAddress\]");
}
} // end Program
David Anton http://www.tangiblesoftwaresolutions.com Convert VB to C#, C++, or Java Convert C# to VB, C++, or Java Convert C++ to C#, VB, or Java Convert Java to C#, C++, or VB