Hi to every one,
I am having a problem while sending mail from my application. iI want to send mail from my Vb.Net applications. and it is working fine in my system, but the problem is that when i try to run tha same application from another system where there is no iis installed, its giving me error mail not sent, and when i change the DeliveryMethod to network , giving me tha same problem...
So can anyone help me out with this problem..
The code is as below.
Public pInPassword As String
Public pOutMailId As String
Private Sub btnSend_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSend.Click
Try
'err msg = Request for the permission of type 'System.net.mai l.smtpPermissio n, system, Version=2.0.0.0 , Culture=neutral , PublicKey token= b77a5c561934e08 9' failed
Dim msg As System.Net.Mail .MailMessage
Dim objSmtp As New System.Net.Mail .SmtpClient("65 .175.81.34")
msg = New System.Net.Mail .MailMessage(tx tFrom.Text, txtTo.Text, txtSub.Text, txtBody.Text)
msg.IsBodyHtml = True
If check() = True Then
objSmtp.Credent ials = New System.Net.Netw orkCredential(t xtFrom.Text, txtPassword.Tex t, "65.175.81. 34")
objSmtp.Deliver yMethod = SmtpDeliveryMet hod.SmtpDeliver yMethod.Network
objSmtp.Send(ms g)
MessageBox.Show ("Mail Sent Successfully... .")
ClearForm()
End If
Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
Thank you in advance.
Deepak
I am having a problem while sending mail from my application. iI want to send mail from my Vb.Net applications. and it is working fine in my system, but the problem is that when i try to run tha same application from another system where there is no iis installed, its giving me error mail not sent, and when i change the DeliveryMethod to network , giving me tha same problem...
So can anyone help me out with this problem..
The code is as below.
Public pInPassword As String
Public pOutMailId As String
Private Sub btnSend_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSend.Click
Try
'err msg = Request for the permission of type 'System.net.mai l.smtpPermissio n, system, Version=2.0.0.0 , Culture=neutral , PublicKey token= b77a5c561934e08 9' failed
Dim msg As System.Net.Mail .MailMessage
Dim objSmtp As New System.Net.Mail .SmtpClient("65 .175.81.34")
msg = New System.Net.Mail .MailMessage(tx tFrom.Text, txtTo.Text, txtSub.Text, txtBody.Text)
msg.IsBodyHtml = True
If check() = True Then
objSmtp.Credent ials = New System.Net.Netw orkCredential(t xtFrom.Text, txtPassword.Tex t, "65.175.81. 34")
objSmtp.Deliver yMethod = SmtpDeliveryMet hod.SmtpDeliver yMethod.Network
objSmtp.Send(ms g)
MessageBox.Show ("Mail Sent Successfully... .")
ClearForm()
End If
Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
Thank you in advance.
Deepak
Comment