Email Application

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 25
Reputation: anitha joe has a little shameless behaviour in the past 
Solved Threads: 0
anitha joe anitha joe is offline Offline
Light Poster

Email Application

 
0
  #1
Mar 24th, 2009
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:
  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:
  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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: Email Application

 
0
  #2
Mar 25th, 2009
hi,

which version of asp.net r u using.
where did u declare smtpmail
If u r query is achieved,mark the thread as solved

Live and Let Live
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 9
Reputation: anithajoe is an unknown quantity at this point 
Solved Threads: 0
anithajoe anithajoe is offline Offline
Newbie Poster

Re: Email Application

 
0
  #3
Mar 25th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: Email Application

 
0
  #4
Mar 26th, 2009
hi,

check this code.you have to add name space

  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.  
If u r query is achieved,mark the thread as solved

Live and Let Live
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 52
Reputation: brightline is an unknown quantity at this point 
Solved Threads: 0
brightline brightline is offline Offline
Junior Poster in Training

Re: Email Application

 
0
  #5
Mar 26th, 2009
You should Specify your SmtpServer as following:
SmtpMail.SmtpServer = "abc"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC