Results 1 to 7 of 7

Thread: How to send mail on submit button?

  1. #1
    Join Date
    Jan 2009
    Posts
    36

    How to send mail on submit button?

    Hi,
    I am working with vb.net
    I want my Submit button to send the data entered on the form Textboxes to be email at a particular email ID.
    I want to do this simultaneously when user click on submit button I want it to get stored in database as well as a mail should be send to a specified email ID.

    Please help me with the mail sending part am not too confident with this!

  2. #2
    Join Date
    May 2008
    Posts
    44

    Re: How to send mail on submit button?

    I guess one of the easiest ways might be to specify email addr in the action

    e.g.

    <form action=mailto:[email protected] method="POST" enctype="text/plain">

    The trouble with using this method to send form results is that it is highly dependent on the browser in use and the email client in use

    Do u have any server sided code? If so, you would be better off using that

  3. #3
    Join Date
    May 2008
    Posts
    13

  4. #4
    Join Date
    May 2008
    Posts
    35

    Re: How to send mail on submit button?

    Best way in an asp .net page is to use the System.Net.Mail functionality for the mail. Please refer to http://forums.asp.net/t/971802.aspx on how to do it.

    1. Include that helper class in your site.

    2. Get the data from each of the textboxes and format it as required.

    3. Put that formatted data as the body of your message.

    4. Fire the mail sending event on the clickevent of the Submit button.

    Lemme know in case you face any problems. Looking forward to hear from you.

  5. #5
    Join Date
    Jun 2008
    Posts
    144

    Re: How to send mail on submit button?

    This is what you need to refer for ASP.NET!
    http://www.webwizguide.com/kb/asp_tu...s_tutorial.asp

    I hope you can develop code for Vb.net too!

    EDIT:

    http://www.thescarms.com/dotnet/Email.aspx for vb.net!

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: How to send mail on submit button?

    The .NET framework provides you with a class called SmtpMail - which under normal circumstances isn't available for use with Windows forms. It's meant for ASP.NET applications and can be found in the library System.Web.Mail namespace. All you've to do to make it work in your WinForm application is include a Reference to the file, System.Web.dll. This can be done by right-clicking on References in your Project explorer and clicking Add reference.

    Once you've added this, use the following code to send mails out:

    Code:
    Imports System;
    Imports System.Web.Mail;
    
    Dim EmailTo As String     'Emailaddres for user to send
    Dim EmailFrom As String   'Emailaddres for user from
    Dim MailSubject As String 'Subject of Mail
    Dim MessageBody As String 'Message
    Dim ServerName As String  'Server Name - important
    
    
    ServerName = "<<Your SMTP server's Name>>"
    'Similarly, add in EmailTo, EmailFrom etc parameters here
    EmailTo = "[email protected]"
    EmailFrom = "[email protected]"
    ...
    .....
    
    
    'Set the SMTP Server's address
    SmtpMail.SmtpServer = ServerName
    
    
    'This is the code that sends out the email based on whatever server information you've set
    'Enclosed within Try-Catch block to catch exceptions in case of errors
    Try
        SmtpMail.Send (EmailFrom, EmailTo, MailSubject, MessageBody)
    Catch ex As Exception
       MsgBox ( "Delivery Failure: " & ex.Source & ex.Message )
    End Try
    Hope this helps!

    http://www.systemnetmail.com/

  7. #7
    Join Date
    Apr 2010
    Posts
    1

    Re: How to send mail on submit button?

    For successful creating of e-mail form use php form.
    Last edited by Maqbool; 20-04-2010 at 10:41 PM. Reason: Removed External Links

Similar Threads

  1. Send button missing in Yahoo mail
    By SULOLA ! in forum Technology & Internet
    Replies: 7
    Last Post: 12-10-2011, 10:40 PM
  2. How to submit form without "Submit Button"?
    By AK_Chopra in forum Software Development
    Replies: 3
    Last Post: 10-09-2009, 08:44 AM
  3. SUBMIT button not working in Firefox
    By KADIN in forum Software Development
    Replies: 3
    Last Post: 29-08-2009, 09:03 PM
  4. Windows Mail SEND button missing
    By Antonio00 in forum Technology & Internet
    Replies: 4
    Last Post: 08-05-2009, 05:44 AM
  5. MOSS CPU is reaching 100 % when clicking on Submit button
    By Pappith in forum Windows Software
    Replies: 4
    Last Post: 15-04-2009, 07:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,604,943.84407 seconds with 16 queries