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!
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:your@email.address 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
Re: How to send mail on submit button?
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.
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!
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 = "someone@recipient.net"
EmailFrom = "me@mysqlf.net"
...
.....
'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/
Re: How to send mail on submit button?
For successful creating of e-mail form use php form.