943,880 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 663
  • ASP.NET RSS
Mar 24th, 2009
0

Email Application

Expand Post »
Hello frens,
I am new to ASP.Net and I am trying to create an application where I want to send my form contents to my email ID. I used the 2 approaches.

1) HTML form:
html Syntax (Toggle Plain Text)
  1. <form enctype="multipart/form-data" runat=server action="mailto:abcd@efgh.com" method="post">
  2. <p>Enter your name below:<br />
  3. <input type="text" name="names" size="100" /></p>
  4. <p><input type="submit" value="Submit Feedback" /><br />
  5. <input type="reset" value="Reset Feedback" /></p>
  6. </form>

While the above code does send me a email with the name entered in the text box "text1", it open MS Outlook when I click on "Submit" button and there I have to again click the Send Button in the Outlook Window. Is there anyway that I can send an email directly just by clicking the Submit button once rather than having to send through Outlook? Something like as soon as I click on the Submit button on my form, it send a email and gives a confirmation that the message was sent.

2) ASP.Net namespace System.Web.Mail:
ASP.NET Syntax (Toggle Plain Text)
  1. using System.Web.Mail;
  2. public partial class email : System.Web.UI.Page
  3. {
  4. protected void Page_Load(object sender, EventArgs e)
  5. {
  6. SmtpMail.Send("abcd@efg.com", "ijkl@mnop.com", "Hiiiii", "body text here");
  7. Response.Write("Success..!");
  8. }
  9. }

This approach does not work at all. It gives me the following exception.
System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid.

Do I need to give some SMTP server destination?

Please help...!

Thanks
Sharon.
Last edited by peter_budo; Mar 26th, 2009 at 10:59 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 4
Solved Threads: 0
Light Poster
anitha joe is offline Offline
25 posts
since May 2008
Mar 25th, 2009
0

Re: Email Application

hi,

which version of asp.net r u using.
where did u declare smtpmail
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Mar 25th, 2009
0

Re: Email Application

I am using ASP.Net 3.0. Do I have to declare? I included the namespace System.Web.Mail

SmtpMail is a class in that namespace and Send is a method. So thats how I used it. If you have any other suggestions, that would help.

Thanks
Sharon.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
anithajoe is offline Offline
9 posts
since Oct 2008
Mar 26th, 2009
0

Re: Email Application

hi,

check this code.you have to add name space

ASP.NET Syntax (Toggle Plain Text)
  1.  
  2. imports system.net.mail
  3. sub sendmail()
  4. Dim msg As New MailMessage
  5. msg.From = txtEmail.Text
  6. msg.To = "info@some.co.in"
  7. 'msg.To = "n@yahoo.com"
  8. msg.Bcc = "n@some.co.in"
  9. msg.Subject = " Demo Info "
  10. msg.BodyFormat = MailFormat.Html
  11. Dim str As String
  12. msg.Body = mail(str)
  13. msg.Priority = MailPriority.High
  14. Try
  15. SmtpMail.SmtpServer = "localhost"
  16. SmtpMail.Send(msg)
  17. Catch ex As HttpException
  18. Catch ex As Exception
  19. Finally
  20. End Try
  21. End Sub
  22.  
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Mar 26th, 2009
0

Re: Email Application

You should Specify your SmtpServer as following:
SmtpMail.SmtpServer = "abc"
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
brightline is offline Offline
57 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Implement SilverLight with ASP.NET
Next Thread in ASP.NET Forum Timeline: How To: Right to left TREE VIEW





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC