Unable to set SMTPServer, set MailMessage.
http://systemwebmail.com/faq/3.8.aspx
Private subject (Sender As Object, e as system.eventargs) Dim Mail as new mailmessage () mail.to = "me@mycompany.com" mail.from = "You@yourcompany.com" mail.subject = "this is IS a test email. "mail.body =" Some text Goes here "mail.fields.add (" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate "," 1 ") 'Basic Authentication Mail.fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendusername", "MY_USERNAME_HERE") 'set your username here mail.fields.add ("http://schemas.microsoft.com/cdo/configuration/ SendPassword "," super_secret ") 'set you password here smtpmail.smtpserver =" mail.mycompany.com "' Your Real Server Goes Here Smtpmail.send (Mail) End Sub 'Page_load
My code:
Imports SystemImports System.Web.mail
Namespace Sendmail
Public Class usage Public Sub DisplayUsage () 'Display usage instructions in case of error. Console.WriteLine ( "Usage SendMail.exe
Message.fields.add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") Message.fields.add ("http://schemas.microsoft.com/cdo/configuration/sendusername "," jetz ") message.fields.add (" http://schemas.microsoft.com/cdo/configuration/sendpassword "," *** ")
Try SmtpMail.SmtpServer = "smtp.263.net" SmtpMail.Send (Message) Catch ehttp As System.Web.HttpException Console.WriteLine ( "0", ehttp.Message) Console.WriteLine ( "Here is the full error message" ) Console.Write ( "0", ehttp.ToString ()) End Try Catch e As IndexOutOfRangeException 'Display usage instructions if error in arguments. Dim use As usage = New usage use.DisplayUsage () End Try Catch e As System.Exception 'Display Text of Unknown Error. Console.writeline ("Unknown Exception Occurred 0", E.MESSAGE) Console.Writeline ("0", "0", E.TOSTRING ()) end Try End Sub End Classend NamespaceModule Module1 Sub Main () 'Dim K As New Sendmail.usage' K.Displayusage () Dim M AS New Sendmail.Start M.Main ("Jetzwmx@126.com", "Jetz@263.net", "Hi", "Hello" Console .Readline () End Subend Module