3 Replies - 2468 Views - Last Post: 20 March 2010 - 11:50 AM Rate Topic: -----

#1 VsEgypt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-March 10

cannot send email from local host- nothing sent

Posted 20 March 2010 - 07:01 AM

hello every body
I have a problem..and I could really need some help..

I am trying to send email from localhost...
I am using the following code

System.Net.Mail.MailMessage obj = new System.Net.Mail.MailMessage();
                System.Net.Mail.MailAddress Toaddress = new System.Net.Mail.MailAddress("myReciever@hotmail.com");
                System.Net.Mail.MailAddress fromAddress = new System.Net.Mail.MailAddress("myFrom@hotmail.com", "Sender");
                obj.To.Add(Toaddress );
                obj.From = fromAddress;
                obj.Subject = "trial mail";
                obj.Body = "hello from localhost this is me";
                obj.IsBodyHtml = true;
                SmtpClient client = new SmtpClient();      
                client.Host = "localhost";
                client.Port = 25;
                client.Send(obj);



and I configured iis and smtp server to work...[added 127.0.0.1 ip to smtp properties/access tab>relay widow]

but I got no exception and yet NOTHING is sent...
what have i missed???

thanks

This post has been edited by JackOfAllTrades: 20 March 2010 - 08:01 AM
Reason for edit:: Added code tags. PLEASE!!! [code]...POST YOUR CODE IN HERE...[/code]


Is This A Good Question/Topic? 0
  • +

Replies To: cannot send email from local host- nothing sent

#2 beju0506  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 78
  • Joined: 23-February 08

Re: cannot send email from local host- nothing sent

Posted 20 March 2010 - 07:54 AM

I dunno about the code you posted (I haven't tried to do anything with SMTP on .NET programs yet) but I do know that a lot of SMTP servers (on the receiving end) won't accept mail from just any SMTP server. Try setting up the program to use a known SMTP server for sending the mail and see if your mail comes through. I know a lot of places are getting tougher on taking mail from an unverified SMTP server due to spam, etc.
Was This Post Helpful? 3
  • +
  • -

#3 VsEgypt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-March 10

Re: cannot send email from local host- nothing sent

Posted 20 March 2010 - 09:53 AM

thanks so much for your help..
yes I tried sending using gmail server and it worked
Was This Post Helpful? 0
  • +
  • -

#4 beju0506  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 78
  • Joined: 23-February 08

Re: cannot send email from local host- nothing sent

Posted 20 March 2010 - 11:50 AM

VsEgypt:

No problem, I'm glad to help. I had been writing a program a while back to send myself an email if something happened and spent almost a week trying to figure out why the emails weren't arriving... so I understand how frustrating it can be :)

Good luck! :)


View PostVsEgypt, on 20 March 2010 - 08:53 AM, said:

thanks so much for your help..
yes I tried sending using gmail server and it worked

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1