Hi All,
I need to send email from a C# application from localhost. I was successful in sending email using gmail SMPT port and host. But i need send email from local host SMPT virtual server. I followed the steps explained in http://forums.asp.net/t/268037.aspx and http://weblogs.asp.net/steveschofield/archive/2007/08/15/send-email-from-your-local-machine.aspx but the mail was not sending from my application. Also when i execute the command telnet mail.contoso.com 25 in commad promt. It shows "Connecting To mail.contoso.com...Could not open connection to the host, on port
25: Connect failed". Please help me to solve this.
Thanks
anish.anick
0
Light Poster
Recommended Answers
Jump to PostYou should have to enabled - "Internet Mail Server (SMTP)" of firewall.
Jump to Postuse this code for "localhost"
using System.Web.Mail; . . . MailMessage xMailMessage = new MailMessage(); xMailMessage.From = "My Test System <test@test.com>"; xMailMessage.To = "vatoovatoo@mousavi.net"; xMailMessage.Subject = "This is a test"; xMailMessage.BodyFormat = MailFormat.Html; xMailMessage.Body = "<html><head><title>Test emial</title></head><br /><br /><hr>JUST A TEST<hr><br /><br /></body></html>"; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(xMailMessage); …
All 5 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
VatooVatoo
21
Light Poster
serkan sendur
821
Postaholic
Banned
shobhitzone
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.