473,382 Members | 1,336 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,382 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 843
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

13
by: G | last post by:
Hello, Is it possible to send form values from PAGE1 to PAGE2, and then retain the form info for PAGE3 without using cookies, sessions or DB storage? Also, I dont want to repost page2 to page3...
3
by: Kenny | last post by:
I'm trying to retrieve the data off a form (survey.htm) and email the results back to me using CDO and ASP (survey.asp). I'm confused as to how to retrieve the form data from survey.htm and send...
0
by: Muhsin | last post by:
Hi, I have a web form that is supposed to send data to a sql server using stored procedure. The problem is that, when I enter everything in the form (including the upload file) and press...
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:
4
by: Miguel Dias Moura | last post by:
Hello, i created an ASP.net / VB page with a really big form. Now i want to create 4 pages and in each one i will place 1/4 of the big form. The last page will send all the form values by...
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:
6
by: nganapat | last post by:
I am trying to post form values to a https web page programmatically using Httpwebrequest but no matter what I do the same login page is returned instead of the next page. I would very much...
5
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the...
0
by: Doug | last post by:
I have a form where I need to send the values of the fields to a different server. PostBackURL doesn't do this unless the target page is on the same server. Same with the standard POST method. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.