469,644 Members | 1,774 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

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 1897
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Chuck Farah | last post: by
88 posts views Thread by Mike | last post: by
3 posts views Thread by Chuck Farah | last post: by
2 posts views Thread by Danny Smith | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.