Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hai,
 
I am in problem.. Here is my code.
MailMessage mail = new MailMessage(Mail.Text, "enquiry@domain.com", Subject.Text, Statement.Text);
SmtpClient SMTPServer = new SmtpClient();
SMTPServer.Host = "smtpout.secureserver.net";
SMTPServer.Port = 465;
SMTPServer.EnableSsl = true;
SMTPServer.Credentials = new System.Net.NetworkCredential("username", "psw");
SMTPServer.Send(mail);
Posted 7-Aug-12 7:10am
Edited 7-Aug-12 8:15am
v2
Comments
ryanb31 at 7-Aug-12 12:12pm
   
Sounds like you need to make sure your connecting properly.
Member 9327701 at 7-Aug-12 12:14pm
   
can you give detailed information
ryanb31 at 7-Aug-12 12:23pm
   
No. You are passing the basic stuff, that is host, port, and credentials but you'll have to get with whoever manages the SMTP server that you are trying to connect to and figure out what part is missing.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Looks like some issue with your implementation.
 
Have a look at this Microsoft Video tutorial:
Use ASP.NET to send Email from Website[^]
Tutorials on sending Email in ASP.NET[^]
 
Have a look at this tip too: Sending an Email in C# with or without attachments: generic routine.[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Just be sure these 2 lines are proper:
 
SMTPServer.Port = 25;
SMTPServer.EnableSsl = false;
 
Some times it sending the response and due to security reasons it is unable to send the mail.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

MailMessage mail = new MailMessage(Mail.Text, "enquiry@domain.com", Subject.Text, Statement.Text);
SmtpClient SMTPServer = new SmtpClient();
SMTPServer.Host = "smtpout.secureserver.net";
SMTPServer.Port = 465;
SMTPServer.EnableSsl = true;
SMTPServer.Credentials = new System.Net.NetworkCredential("username", "psw");
 
SMTPServer.ServicePoint.MaxIdleTime = 1; /* this code prevent your message from terminated */
 
SMTPServer.Send(mail);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,205
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,474


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 30 Sep 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100