| | |
Problem Sending Mail
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
Hi!
This is the code I have for sending mail-
The error message I get is-
System.Web.HttpException: The transport failed to connect to the server.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- End of inner exception stack trace ---
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at MyMailer.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\tuse\AppData\Local\Temporary Projects\MyMailer\Form1.vb:line 32
---------
Tried to google, but no luck.
Any ideas?
This is the code I have for sending mail-
vb.net Syntax (Toggle Plain Text)
Imports System.Web.Mail Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Mailmsg As New System.Web.Mail.MailMessage() SmtpMail.SmtpServer = "mysmtpserver" Mailmsg.To = "recepient@domain.com" Mailmsg.From = "\" & "foo" & "\ <" & "bar@domain.com" & ">" Mailmsg.Subject = "Sending a test mail" 'Mail Body Mailmsg.Body = "This is a test message" Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myusername") 'set your username here Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword") 'set your password here Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "26") 'Put port number here Try SmtpMail.Send(Mailmsg) Catch ex As Exception 'MsgBox(ex.ToString) Me.TextBox1.Text = ex.ToString End Try End Sub End Class
The error message I get is-
System.Web.HttpException: The transport failed to connect to the server.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- End of inner exception stack trace ---
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at MyMailer.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\tuse\AppData\Local\Temporary Projects\MyMailer\Form1.vb:line 32
---------
Tried to google, but no luck.
Any ideas?
My blog on .NET- http://dotnet.tekyt.info
If I try port 25, I get this message-
System.Web.HttpException: The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- End of inner exception stack trace ---
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at MyMailer.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\tuse\AppData\Local\Temporary Projects\MyMailer\Form1.vb:line 32
System.Web.HttpException: The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- End of inner exception stack trace ---
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at MyMailer.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\tuse\AppData\Local\Temporary Projects\MyMailer\Form1.vb:line 32
My blog on .NET- http://dotnet.tekyt.info
•
•
Join Date: Nov 2008
Posts: 63
Reputation:
Solved Threads: 10
VB.NET Syntax (Toggle Plain Text)
SmtpMail.SmtpServer = "mysmtpserver"
Regards,
Richard
The Netherlands
[edit]
Be aware that most smtp servers don't respond on RELAY. Systemadministrators block relaying their smtp server
Last edited by 4advanced; Nov 27th, 2008 at 1:31 pm.
I did put valid values in the actual code I used, just did not want to post it here.
Have used a correct smtp server, username, password - sure of that
Have used a correct smtp server, username, password - sure of that
My blog on .NET- http://dotnet.tekyt.info
•
•
Join Date: Nov 2008
Posts: 63
Reputation:
Solved Threads: 10
Okay, just for asking.....
Check this site, it's a good reference for programming-help. Try the simple example and if that works, extend it piece by piece.
Let me know if it worked....
http://www.systemwebmail.com/faq/2.9.aspx
AND
http://www.systemnetmail.com/
Regards
Check this site, it's a good reference for programming-help. Try the simple example and if that works, extend it piece by piece.
Let me know if it worked....
http://www.systemwebmail.com/faq/2.9.aspx
AND
http://www.systemnetmail.com/
Regards
Last edited by 4advanced; Nov 27th, 2008 at 1:40 pm.
I guess I've specifically used this-
http://www.systemwebmail.com/faq/3.8.aspx
The server requires authentication.
http://www.systemwebmail.com/faq/3.8.aspx
The server requires authentication.
My blog on .NET- http://dotnet.tekyt.info
No luck with port 2525 either, have disabled my firewall too.
Any other troubleshooting steps?
Thanks a lot for your ideas.
Any other troubleshooting steps?
Thanks a lot for your ideas.
My blog on .NET- http://dotnet.tekyt.info
![]() |
Similar Threads
- Problem on Sending E-mail (ASP.NET)
- Problem setting up mail server (PHP)
- problem in sending mail form web application (ASP.NET)
- Obtain Remote Assistance by Sending an E-mail Message in Windows XP (Windows tips 'n' tweaks)
- Obtain Remote Assistance by Sending an E-mail Message in Windows XP (Windows tips 'n' tweaks)
Other Threads in the VB.NET Forum
- Previous Thread: vb.net crystal report
- Next Thread: Line By line printing on Crystal Report
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





