473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Send form values using AspNetEmail. Can you help me out? Thank You

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("localhost")

Dim msgTo, msgFrom, msgName, msgSubject, msgMessage

msgTo = Request.Form("to")

msgFrom = Request.Form("from")

msgName = Request.Form("name")

msgSubject = Request.Form("subject")

msgMessage = Request.Form("message")

' 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><style type='text/css'>body {font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 11px;color: #333333;
background-color: </style></head><body>" &_

"<strong>New Message</strong>" &_

"<br><strong>From: </strong>" & msgFrom &_

"<br><strong>Name: </strong>" & msgName &_

"<br><strong>To: </strong>" & msgTo &_

"<br><strong>Subject: </strong>" & msgSubject &_

"<br><strong>Message Text</strong>" &_

"<br> " & msgMessageField &_

"</body></html>"

' Internal Exceptions

msg.ThrowException = False

' Logging and LogBody

msg.Logging=false

msg.LogBody = false

' Sends Message

If msg.Send() Then

' Redirects to error page

Response.Redirect("status.aspx?result=contactErr")

Else

' Redirects to confirmed page

Response.Redirect("status.aspx?result=contactOk")

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

Nov 20 '05 #1
1 1050
Cor
Hi Miguel,

What is it you want to archieve, because with sending email there are a lot
of possibilities which are not always clear when you start with it the first
time, to name some:
- you can use an SMTP webserver which sends mails for the user (that is
what you are doing now), but not using his own mailclient but that
mailserver. That mailserver can be everywhere however the ISP should allows
that (You can think by this on spammail situation where this is ideal for).
- you can do the same but using your Exchange server.
- you can use the office outlook client.
- you can send a standard client webmail using outlookexpress, outlook
office, lotus mail or whatever mailclient (not with attachments)
- ......... more situations

Some information about this will help you giving you not the wrong
information?

Cor
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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...
5
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...
1
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:
5
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...
6
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...
1
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:
1
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...
3
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...
1
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.