473,378 Members | 1,454 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,378 software developers and data experts.

CDO, ASP and Email Form Problems


How do I alter the follow asp code so the from field produces the a friendly
address
"Name <so*******@changeme.com>"

Code is presently used.

<%
If Request.Form("btnSend").Count 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Request.Form("subject")
objMessage.Sender = Request.Form("From")
objMessage.To = Request.Form("To")
objMessage.TextBody = Request.Form("message")
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailserver"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Response.Redirect("../thanks.htm")
End If
%>

<form action="contact.asp" method="post" name="sendEmail" class="content">
<input type="hidden" name="subject" value="Enquiry from Web Site">
<input type="hidden" name="to"
value="en*******@chaucer.sheffield.sch.uk"/>
<table align="center" cellpadding="5" bordercolor="#000000"
class="content">
<tr>
<td>Your Email Address</td>
<td><input name="From" type="text" class="content" size="53"
/></td>
</tr>
<tr>
<td valign="top"><div align="right">Your Message</div></td>
<td><textarea name="message" cols="50" rows="6"
wrap="VIRTUAL" class="content"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="Send" type="submit" />
</div></td>
</tr>
</table>
<div align="center"></div>
<div align="center"></div>
</form>

Thank you any help.

Steve

"privatenews.microsoft.com" wrote:
Try,

http://weblogs.asp.net/steveschofiel...ipt_2E00_.aspx

Thanks,

Steve Schofield
Microsoft MVP - IIS

"Steve Audus, Chaucer BEC, Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:10**********************************@microsof t.com...
I have successful setup email forms on our web site using CDO and ASP
scripting,
using this coding
http://www.ilopia.com/Articles/Windo...r2003/CDO.aspx

It is used on this page
http://www.chaucer.sheffield.sch.uk/about/contact.asp

The form works, but when the mail arrives it in the inbox, the senders
name
is not displayed, as it is not included in the form.

Only "From (Email Address)" and "Message" are included.

How do I add a name field, and maybe extra field to be included in the
message.

Thank you for any help.

Jun 27 '08 #1
5 2012
I don't think you can, I think its your email program that stores that info.
If you have this address in your contacts, it will use the friendly name.

"Steve Audus, Chaucer BEC, Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:20**********************************@microsof t.com...
>
How do I alter the follow asp code so the from field produces the a
friendly
address
"Name <so*******@changeme.com>"

Code is presently used.

<%
If Request.Form("btnSend").Count 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Request.Form("subject")
objMessage.Sender = Request.Form("From")
objMessage.To = Request.Form("To")
objMessage.TextBody = Request.Form("message")
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailserver"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Response.Redirect("../thanks.htm")
End If
%>

<form action="contact.asp" method="post" name="sendEmail" class="content">
<input type="hidden" name="subject" value="Enquiry from Web
Site">
<input type="hidden" name="to"
value="en*******@chaucer.sheffield.sch.uk"/>
<table align="center" cellpadding="5" bordercolor="#000000"
class="content">
<tr>
<td>Your Email Address</td>
<td><input name="From" type="text" class="content"
size="53"
/></td>
</tr>
<tr>
<td valign="top"><div align="right">Your Message</div></td>
<td><textarea name="message" cols="50" rows="6"
wrap="VIRTUAL" class="content"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="Send" type="submit" />
</div></td>
</tr>
</table>
<div align="center"></div>
<div align="center"></div>
</form>

Thank you any help.

Steve

"privatenews.microsoft.com" wrote:
>Try,

http://weblogs.asp.net/steveschofiel...ipt_2E00_.aspx

Thanks,

Steve Schofield
Microsoft MVP - IIS

"Steve Audus, Chaucer BEC, Sheffield UK"
<St*****************************@discussions.micr osoft.comwrote in
message
news:10**********************************@microso ft.com...
>I have successful setup email forms on our web site using CDO and ASP
scripting,
using this coding
http://www.ilopia.com/Articles/Windo...r2003/CDO.aspx

It is used on this page
http://www.chaucer.sheffield.sch.uk/about/contact.asp

The form works, but when the mail arrives it in the inbox, the senders
name
is not displayed, as it is not included in the form.

Only "From (Email Address)" and "Message" are included.

How do I add a name field, and maybe extra field to be included in the
message.

Thank you for any help.


Jun 27 '08 #2

<Steve Audus>; <Chaucer BEC>; "Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:20**********************************@microsof t.com...
>
How do I alter the follow asp code so the from field produces the a
friendly
address
"Name <so*******@changeme.com>"
The only thing you could do is add another input for the user to enter their
name.
You can then assignt the From field with:-

..From = Request.Form("name") & "<" & Request.Form("email") & ">"

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #3
That would work, but I am not very experienced with asp.

I tried but the page isn't working now, please advise further.

<%
If Request.Form("btnSend").Count 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Request.Form("subject")

objMessage.Sender = Request.Form("From = Request.Form("name") & "<" &
Request.Form("email") & ">")

objMessage.To = Request.Form("To")
objMessage.TextBody = Request.Form("message")
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailserver"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Response.Redirect("../thanks.htm")
End If
%>

Thank you for any help

Steve

"Anthony Jones" wrote:
>
<Steve Audus>; <Chaucer BEC>; "Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:20**********************************@microsof t.com...

How do I alter the follow asp code so the from field produces the a
friendly
address
"Name <so*******@changeme.com>"

The only thing you could do is add another input for the user to enter their
name.
You can then assignt the From field with:-

..From = Request.Form("name") & "<" & Request.Form("email") & ">"

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #4

<Steve Audus>; <Chaucer BEC>; "Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:85**********************************@microsof t.com...
That would work, but I am not very experienced with asp.

I tried but the page isn't working now, please advise further.

<%
If Request.Form("btnSend").Count 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Request.Form("subject")

objMessage.Sender = Request.Form("From = Request.Form("name") & "<" &
Request.Form("email") & ">")

objMessage.To = Request.Form("To")
objMessage.TextBody = Request.Form("message")
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailserver"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Response.Redirect("../thanks.htm")
End If
%>

Thank you for any help

This in your code:-

objMessage.Sender = Request.Form("From = Request.Form("name") & "<" &
Request.Form("email") & ">")

Should be this:-

objMessage.From = Request.Form("name") & "<" & Request.Form("email") & ">"

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #5
Spot on, Thank you Thank You Thank you.

"Anthony Jones" wrote:
>
<Steve Audus>; <Chaucer BEC>; "Sheffield UK"
<St*****************************@discussions.micro soft.comwrote in message
news:85**********************************@microsof t.com...
That would work, but I am not very experienced with asp.

I tried but the page isn't working now, please advise further.

<%
If Request.Form("btnSend").Count 0 Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Request.Form("subject")

objMessage.Sender = Request.Form("From = Request.Form("name") & "<" &
Request.Form("email") & ">")

objMessage.To = Request.Form("To")
objMessage.TextBody = Request.Form("message")
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailserver"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Response.Redirect("../thanks.htm")
End If
%>

Thank you for any help


This in your code:-

objMessage.Sender = Request.Form("From = Request.Form("name") & "<" &
Request.Form("email") & ">")

Should be this:-

objMessage.From = Request.Form("name") & "<" & Request.Form("email") & ">"

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #6

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

Similar topics

3
by: Chuck Farah | last post by:
I am unsuccessfullly trying to display an outlook email from a vb web forms (.net) outlook 2002 #1. is it possible to use outlook client email from a web form using the outlook object model...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
3
by: Chuck Farah | last post by:
I am unsuccessfullly trying to display an outlook email from a vb web forms (.net) outlook 2002 #1. is it possible to use outlook client email from a web form using the outlook object model...
2
by: Danny Smith | last post by:
Hi folks, I'm having problems with my PHP form handler. It used to work correctly, but now for some reason its not. I'm hoping someone here could take a look and tell me where I might have gone...
3
by: dtvuser | last post by:
Hi, I'm new to PHP and seem to be having soom problems, I'm getting confused with all the different styles of script writing. I've created a PHP script to submit details to my email but the...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.