0

I have written a program which sends mail in C#. The program works perfectly fine when i m using my modem (Reliance Datacard) for internet. My problem is the function doesn't work when the system is connected to internet using Wifi network??

Note: Line no 96 is Selected in code snippet (Client.Send())

This is code i have written

This is the Error message i get when i try to run the program over wifi

Himanshu
  • 4,327
  • 16
  • 31
  • 39
sky
  • 55
  • 1
  • 10
  • not sure if this matters but I notice a few things missing from your code for example `client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false;` also check to make sure you have Internet access when connected to the wifi first before even attempting to send email.. also check this previous posting to see if changing some settings here would help http://stackoverflow.com/questions/28234478/error-on-sending-email-using-gmail-the-smtp-server-requires-a-secure-connection – MethodMan Apr 02 '15 at 19:58
  • Internet connectivity is working fine. I ll try the rest of options – sky Apr 02 '15 at 20:03
  • here is one other alternative then http://stackoverflow.com/questions/5004972/send-email-via-c-sharp-through-my-lan-interface – MethodMan Apr 02 '15 at 20:04
  • I added the `client.DeliveryMethod = SmtpDeliveryMethod.Network`, `client.UseDefaultCredentials = false`, still the problem persists – sky Apr 02 '15 at 20:09
  • is this on your own private network or at work..? perhaps you have something not setup properly in your wireless router / LAN – MethodMan Apr 02 '15 at 20:11
  • Are you connected to the Internet through a proxy server? – Praveen Paulose Apr 02 '15 at 20:19
  • The wifi connection is hosted by my college. I m not sure but i think yes, it works on a proxy server. – sky Apr 02 '15 at 20:20
  • 1
    Then its your proxy / firewall that is blocking the connection from sending out emails. Try this http://stackoverflow.com/questions/844835/sending-mail-through-http-proxy – Praveen Paulose Apr 02 '15 at 21:26
  • 1
    Please copy/paste your code rather than taking a screenshot. That way, if somebody wants to modify your code to answer it, they don't need to type it from scratch. Plus, it's friendlier to those on slow internet connections. – Wai Ha Lee Apr 02 '15 at 23:13
  • It probably is your college blocking you. They block a lot of the "abused" ports (or, I should say, most hardware you buy does). Try a service like MailGun or SendGrid (there are free tiers as well assuming you're not mass-mailing). – Brad Christie Apr 03 '15 at 04:16
  • 1
    @WaiHaLee: You forgot about the text-only browsers. (And sorry, just have to laugh a bit about slow internet connections. I remember dialing up and now my phone has a connection I would have _loved_ to have used back in my gaming days.) – Brad Christie Apr 03 '15 at 04:20
  • Thank you everyone....it was my college's proxy settings which were causing the problems. @BradChristie ur suggestion was really helpful. – sky Jul 04 '15 at 08:29
  • @WaiHaLee: I will take care from next time. Thanks for the advice. – sky Jul 04 '15 at 08:32

0 Answers0