Smtp mail - Failure sending mail.

teszero

New member
Joined
Nov 28, 2014
Messages
4
Programming Experience
Beginner
Hello, i am making a simple smtp email sender.
i made it, i tested it, it works fine but... only in my developer machine.

in all others machines that i install my application it gives me "Failure to send email"
I am developing in the same network than the other machines.

do i need to install something in the other machines? or add a refference file?

my code is this:


Imports System.Net.Mail


Public Class Form1
Dim mandarmail
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

mandarmail = ("Nota de Encomenda procedente.")
Try
Dim mail As New MailMessage()
mail.From = New MailAddress("my email")
mail.[To].Add("email to send")
mail.Subject = "Nota de Encomenda - " & nr_mec
mail.Body = mandarmail
Dim smtp As New SmtpClient("smtp server")
smtp.Port = 25
smtp.Send(mail)
MsgBox("ok.")
End

Catch ex As Exception
MsgBox(ex.Message)
End Try
'MsgBox err.description
End Sub


End Class


Thank you in advance for your help.

Regards
Pedro Silva
Portugal
 
Hello, can someone help? :|

I found a difference, some of the computer uses netframework 3.5 and i was developing this application in netframework 4.0.
I tryed to change it to 3.0 and 3.5 but... with the same result...


Can it be because the class import?
in two days... i cant find the solution Sad


do i need to install something in the other machines? or add a reference file?


All other computer have outlook installed and sending emails by smtp port 25 without a problem...
but with my application build gives "Failure sending email."


this is a more simple code example, it still works in my computer, but is not working in all other computers:


_______________________________________________


Imports System.Net.Mail


Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error GoTo 11
Dim msg As New MailMessage()
msg.From = New MailAddress("test@gmail.com", "Email Test")
msg.To.Add("myemail@yahoo.com")
msg.Subject = "Hey, this is a test"
msg.Body = "smtp email sending test"
Dim client As New SmtpClient()
client.Host = "mysmtp"
client.Port = 25
client.Send(msg)
MsgBox("OK")
GoTo 10


11:
MsgBox(Err.Description)
10:
End Sub




End Class


_____________________________________________________




Thank you in advance for your help.


Regards
Pedro Silva
Portugal
 
i tryed to tellnet to my smtp server and... in my computer it allows me, and in all the others computers it denys me.
But... my computer is in the same work situation, i just installed Vb.net express on it...

is any way to overpass it?

Regards.
 
Hello, i solved my problem.


If someone found the same problem... my problem was in the Mcafee anti virus...

It was blocking my smtp 25 door...

Because i am working in a huge network, i couldn't change my anti-virus definitions, because it is refreshed automatically by server...
And... because i couldn't wait for my IT manager, i just solved the problem myself, i changed my application name for a exe name that is automatically allowed by Mcafee Antivirus.
And, it is working very well :)

For someone who have the same problem, those are the names allowed by default:
agent.exe, amgrsrvc.exe, apache.exe, ebs.exe, eudora.exe, explorer.exe, firefox.exe, firesvc.exe, iexplore.exe, inetinfo.exe, mailscan.exe, MAPISP32.exe, mdaemon.exe, modulewrapper*, mozilla.exe, msexcimc.exe, msimn.exe, mskdetct.exe, msksrvr.exe, msn6.exe, msnmsgr.exe, neo20.exe, netscp.exe, nlnotes.exe, nrouter.exe, nsmtp.exe, ntaskldr.exe, opera.exe, outlook.exe, Owstimer.exe, pine.exe, poco.exe, RESRCMON.EXE, rpcserv.exe, sisqualponto.exe, SPSNotific*, thebat.exe, thunde*.exe, tomcat.exe, tomcat5.exe, tomcat5w.exe, VMIMB.EXE, webproxy.exe, WinMail.exe, winpm-32.exe, worldclient.exe, wspsrv.exe

Thank you for your attention :)
Regards,
Pedro Silva
 
Back
Top