Hello,
Can you help me out in making this work? What I want is as simple as sending
form values to an email.
The code I am using is the following:
<Script runat="server">
Private Sub Page_Load()
Dim msg As EmailMessage = New EmailMessage("l ocalhost")
Dim msgTo, msgFrom, msgName, msgSubject, msgMessage
msgTo = Request.Form("t o")
msgFrom = Request.Form("f rom")
msgName = Request.Form("n ame")
msgSubject = Request.Form("s ubject")
msgMessage = Request.Form("m essage")
' Set the email type
msg.BodyFormat = MailFormat.Html
' Set the from address
msg.FromAddress = msgFrom
' Set the to address
msg.To = msgTo
' Set the from name
msg.FromName = msgFrom
' Set the email subject
msg.Subject = msgSubject
' Set the email message
msg.Body = "<html><head><s tyle type='text/css'>body {font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 11px;color: #333333;
background-color: </style></head><body>" &_
"<strong>Ne w Message</strong>" &_
"<br><strong>Fr om: </strong>" & msgFrom &_
"<br><strong>Na me: </strong>" & msgName &_
"<br><strong>To : </strong>" & msgTo &_
"<br><strong>Su bject: </strong>" & msgSubject &_
"<br><strong>Me ssage Text</strong>" &_
"<br> " & msgMessageField &_
"</body></html>"
' Internal Exceptions
msg.ThrowExcept ion = False
' Logging and LogBody
msg.Logging=fal se
msg.LogBody = false
' Sends Message
If msg.Send() Then
' Redirects to error page
Response.Redire ct("status.aspx ?result=contact Err")
Else
' Redirects to confirmed page
Response.Redire ct("status.aspx ?result=contact Ok")
End If
End Sub
</script>
I really would appreciate if you could send me a working example using my
code. I am trying to make it work for 1 week and until now I had no luck.
The form has 5 text inputs: to, from, name, subject and message AND a button
which when pressed should send the form values in the email.
I tryied to comment everything I could think of. I am working in ASP.net /
VB.
Thank You Very Much,
Miguel Moura 1 2171
Miguel
You don't say exactly what doesn't work with yours (empty form fields, no mail message, etc.), but anyway I would do it in the code-behind (not in the html). Here's a simplified example
Private Sub btnSubmit_Click (ByVal sender As Object,
ByVal e As System.EventArg s) Handles btnSubmit.Clic
' Send the message..
Dim msg As New Mail.MailMessag
msg.To = txtTo.Tex
msg.From = txtFrom.Tex
msg.Body = txtMessage.Tex
Mail.SmtpMail.S mtpServer = "My Mail Server
Mail.SmtpMail.S end(msg
End Su
The form itself just has txtTo, txtFrom, and txtMessage as the IDs of input fields and btnSubmit as the ID of the submit button
If you're not getting any messages sent at all, you might check your smtp server. I don't know all the ins and outs, but do know that you can only use localhost if your box is configured to send mail (mine isn't, and I think it also has to do with the o/s)
hth
Bil
----- Miguel Dias Moura wrote: ----
Hello
Can you help me out in making this work? What I want is as simple as sendin
form values to an email
The code I am using is the following
<Script runat="server"
Private Sub Page_Load(
Dim msg As EmailMessage = New EmailMessage("l ocalhost"
Dim msgTo, msgFrom, msgName, msgSubject, msgMessag
msgTo = Request.Form("t o"
msgFrom = Request.Form("f rom"
msgName = Request.Form("n ame"
msgSubject = Request.Form("s ubject"
msgMessage = Request.Form("m essage"
' Set the email typ
msg.BodyFormat = MailFormat.Htm
' Set the from addres
msg.FromAddress = msgFro
' Set the to addres
msg.To = msgT
' Set the from nam
msg.FromName = msgFro
' Set the email subjec
msg.Subject = msgSubjec
' Set the email messag
msg.Body = "<html><head><s tyle type='text/css'>body {font-family
Verdana, Arial, Helvetica, sans-serif; font-size: 11px;color: #333333
background-color: </style></head><body>" &
"<strong>Ne w Message</strong>" &
"<br><strong>Fr om: </strong>" & msgFrom &
"<br><strong>Na me: </strong>" & msgName &
"<br><strong>To : </strong>" & msgTo &
"<br><strong>Su bject: </strong>" & msgSubject &
"<br><strong>Me ssage Text</strong>" &
"<br> " & msgMessageField &
"</body></html>
' Internal Exception
msg.ThrowExcept ion = Fals
' Logging and LogBod
msg.Logging=fal s
msg.LogBody = fals
' Sends Messag
If msg.Send() The
' Redirects to error pag
Response.Redire ct("status.aspx ?result=contact Err"
Els
' Redirects to confirmed pag
Response.Redire ct("status.aspx ?result=contact Ok"
End I
End Su
</script
I really would appreciate if you could send me a working example using m
code. I am trying to make it work for 1 week and until now I had no luck
The form has 5 text inputs: to, from, name, subject and message AND a butto
which when pressed should send the form values in the email
I tryied to comment everything I could think of. I am working in ASP.net
VB
Thank You Very Much
Miguel Moura This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kassam |
last post by:
Hi MVPs out there.
I have constructed an order form and the users will enter the informtion. I
now need to send the filled out form as an e-mail (body being the HTML with
the fille din data) to a predefined e-mail address. I know how to use CDO. I
don't want to go to another page to recontruct the HTML as the '.body'
Thank you in anticipation.
Kassam
|
by: varun |
last post by:
hello friends,
i have been developing an application in asp.net.
i want to inherit a web page on all other web pages of
my application.
i took a form and callded it mybaseform1.
then i took another form, say webform1, and tried to
|
by: Miguel Dias Moura |
last post by:
Hello,
Can you help me out in making this work? What I want is as simple as sending
form values to an email.
The code I am using is the following:
|
by: Miguel Dias Moura |
last post by:
Hello,
i have an ASP.net / VB page with a Script (submitValues) and a Form.
1. The form has 20 input texts and a "Submit" button.
2. The script declares 20 variables. The value of each variable is taken
from each of the 20 input texts.
3. When the button "Submit" is click the variable values are sent to an
email address using AspNetEmail.
|
by: Sandy |
last post by:
Hello -
I want to be able to send an email from my app that contains the logo from
my website at the top of it. I have searched the web and there are many
components out there, but isn't there an easier way? My logo is quite simple.
Any help will be greatly appreciated!
--
Sandy
| |
by: Miguel Dias Moura |
last post by:
Hello,
Can you help me out in making this work? What I want is as simple as sending
form values to an email.
The code I am using is the following:
|
by: Miguel Dias Moura |
last post by:
Hello,
i have an ASP.net / VB page with a Script (submitValues) and a Form.
1. The form has 10 input text and a "Submit" button.
2. The script declares 10 variables. The value of each variable is taken
from each of the 10 input texts.
3. When the button "Submit" is click the variable values are sent to an
email address using AspNetEmail.
|
by: YMPN |
last post by:
Hi Everyone,
I'm deen from Riyadh.
Please do help me with some problem i have. I have this formview
control setup to recieved inputs from user (textbox, dropdownlist,
others).
After inserting, I want to send the data via email, the problem is how
do I do that?
|
by: chaitanya02 |
last post by:
Hi All,
Well- this question might have appeared several times on this forum- but would appreciate your reply on this:
I have a asp page, where customers login with some username and the pwd, which are stored in sql. i should be using this user name and pwd and check if it is the same as the userid and the pwd in the sql 4 table..IF so then:
display the download url which is in sql3 by querying the four tables..
These four tables are...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |