Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make McAfee cool with sending mail from my workstation?

I am developing an application for a server and it must send mail occasionally for notifications to users.

MailMessage mm = new MailMessage();

mm.To.Add("[email protected]");
mm.From = new MailAddress("[email protected]");
mm.Subject = "J/K";
mm.Priority = MailPriority.Normal;
mm.IsBodyHtml = false;
mm.Body = "Greetings and salutations";

SmtpClient client = new SmtpClient("host.address.lcl");
client.Send(mm);

If I put the app on an actual server it works fine, but on my workstation, depending upon how I access the code, it either silently fails or throws an exception. In either case a McLogEvent is generated:

Blocked by port blocking rule (Anti-virus Standard Protection:Prevent 
mass mailing worms from sending mail).

...and the exception says:

System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: 
Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 
No connection could be made because the target machine actively refused it [IP & Port Numbers] 

It looks like a rule on my workstation is working to keep the mail from being generated, directly or indirectly, but I'm not sure what to make of the "actively refused it" part, since if the McLogEvent text seems to suggest that it wouldn't get that far.

I should point out that if I use System.Web.Mail it works great. The drawback being of course compiler messages about this namespace being deprecated in favor of System.Net.Mail.

Anyone have any idea of how to make McAfee cool with sending mail from my workstation?

like image 780
Cyberherbalist Avatar asked Feb 25 '23 18:02

Cyberherbalist


2 Answers

Open mcafee console from the sys tray by right clicking on the McAfee icon and select VirusScan Console

View the properties under Task, Access Protection

Uncheck the rule that blocks outgoing messages on port 25.

edit - the exception saying that it was actively refused is just because McAfee isn't allowing you to make the connection on port 25 to anything, so the exception just thinks you tried a host which didn't have anything on 25 or had a firewall blocking 25.

It's worth pointing out that if your on a corporate network and you're running the enterprise version of McAfee, the setting may be configured at a higher level than your system, so you may not be able to change it - speak to your sysadmin if this is the case.

like image 147
dotalchemy Avatar answered Mar 05 '23 10:03

dotalchemy


It depends if you're in an environment running EPO (McAfee ePolicy Orchestrator) or if your anti-virus is standalone. If EPO then you'll need to have your workstation (and program executable) unblocked in the EPO console.

like image 45
nimizen Avatar answered Mar 05 '23 12:03

nimizen