[thelist] ASPEmail Help (Long)
Administrative HQ
english_offline at yahoo.com
Wed Dec 10 00:36:38 CST 2003
Hi.
We're redesigning a site with a subdomain. It needs a
visual workover but, first, there's a functional
problem.
There is a "Recommend a Friend" form which works on
the main site but - on the subdomain returns an error
notice:
Persits.MailSender.4 error '800a0004'
Cannot assign requested address.
/sendmailinc.asp, line 47
------
The source for the form can be seen is:
<HTML>
<HEAD>
<TITLE>Web Design- Ingla</TITLE>
<!--#include file="DesignTemplate.txt" -->
<script ID="clientEventHandlersJS"
LANGUAGE="javascript">
<!--
//email validation function by D.Iczkov (Jan 2002)
//LANGUAGE=javascript ondeactivate="return
Email_ondeactivate()"
function Email_ondeactivate() {
var filter=/^.+ at .+\..{2,4}$/
var str=window.event.srcElement.value
if (str !="" ){
if (filter.test(str)){
var tempstring = str.split("@")
tempstring = tempstring[1].split(".")
} else {
//message=str && "Please enter your complete and
valid email address!"
alert("Sorry, but the e-mail address given ' " +
str + " ' is invalid.\nPlease enter the correct
address.")
window.event.srcElement.focus()
}
}
}
function putFocus(formInst, elementInst) {
if (document.forms.length > 0) {
document.forms[formInst].elements[elementInst].focus();
}
}
//code to check that the certain fields are entered,
you can add items and change messages accordingly.
function snd_onclick() {
var dosub=true;
if (document.getElementById("name").value=="")
{
alert("Sorry, but we need you name.");
dosub=false;
}
if (document.getElementById("friend1").value=="")
{
alert("Sorry, but we need your friend's name");
dosub=false;
}
if (document.getElementById("email1").value=="")
{
alert("Sorry, but we need your friend's email
address.");
dosub=false;
}
if (dosub==true)
{
document.contact_frm.submit();
}
}
//-->
</script>
<link REL="STYLESHEET" TYPE="text/css"
HREF="styles.css" TITLE="Styles">
</head>
<body onLoad="putFocus(0,4);" topmargin="0">
<td> <img src="blank.gif" width="1" height="1"</td>
<td width="40" valign=top cellpadding="0"
cellspacing="0" border="0" ><font face="verdana,
sans-serif" color="#000000" size="5"><br> </font>
<p>
<table width=500 border=0 cellpadding=0
cellspacing=0><tr><td valign=bottom><img src=blank.gif
width=60 height=1></td>
<td align="left" valign=top width="100%"><h1>Recommend
us to a friend.</h1>
<p>
<form action="sendmail.asp?to_friend=y" method="post"
name="contact_frm" enc_type="text/plain">
<input name="recipient" type="hidden"
value="WebDesign at ingla.com">
<input name="subject" type="hidden" value="
...Suggests this site for you ">
<input name="redirect" type="hidden"
value="confirm.shtm">
<INPUT TYPE="HIDDEN" NAME="Language" VALUE="EN">
<table class="form" width="400" cellspacing="1"
cellpadding="2" border="1" bgcolor="#00998c"
class="footer">
<tr>
<td align="left"><font color="#ffffff"
size="2">Your Name:</font></td>
<td valign="top"> <INPUT size="40"
TYPE="TEXT" name="name" id="name"></td>
</tr>
<!--<tr>
<td align="left"><font size="2">Message for your
friends:</font></td>
<td valign="top"> <textarea rows="3"
cols="15" name="comment"></textarea></td>
</tr>-->
<tr>
<td align="left"><font color="#ffffff"
size="2">Friend's Name:<br>
Friend's Email:</font></td>
<td valign="top"> <INPUT size="40"
TYPE="TEXT" name="friend1" id="friend1" ><br>
<INPUT size="40" TYPE="TEXT" name="email1"
id="email1" LANGUAGE=javascript ondeactivate="return
Email_ondeactivate()"></td>
</tr>
<tr>
<td align="left"><font color="#ffffff"
color="#ffffff"
size="2">Friend's Name 2:<br>
Friend's Email 2:</font></td>
<td valign="top"> <INPUT size="40"
TYPE="TEXT" name="friend2" id="friend2" ><br>
<INPUT size="40" TYPE="TEXT" name="email2"
LANGUAGE=javascript ondeactivate="return
Email_ondeactivate()"></td>
</tr>
<tr>
<td align="left"><font color="#ffffff"
size="2">Friend's Name 3:<br>
Friend's Email 3:</font></td>
<td valign="top"> <INPUT size="40"
TYPE="TEXT" name="friend3" ><br>
<INPUT size="40" TYPE="TEXT" name="email3"
LANGUAGE=javascript ondeactivate="return
Email_ondeactivate()"></td>
</tr>
<tr>
<td align="center">
<INPUT type="button" value="Send" id=snd name=snd
LANGUAGE=javascript onclick="return snd_onclick()">
</td>
<td> </td>
</tr>
</table></form>
</HTML>
------
There are 2 asp pages needed to send.
------
One is: sendmail.asp which reads as follows:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<META NAME="GENERATOR" Content="Microsoft FrontPage
4.0">
</HEAD>
<BODY>
<!--#include file="sendmailinc.asp" -->
<%
'sub sendmail(rec, from, subj, body, [cc], [lang],
[attach], [other])
'Copyright - Duddy Iczkovits 2002-2010
'duddy at iczkovits.com
dim rec, efrom, subj, body, x
efrom=""
body="---------------------" & vbcrlf &"This form was
received at server at:" & vbcrlf &
"---------------------" & vbcrlf
body=body& "Date: " & date & vbcrlf
body=body& "Time: " & time & vbcrlf
body= body & vbcrlf & "----------------" & vbcrlf &
"User Info" & vbcrlf & "----------------" & vbcrlf
body=body & "Browser: " &
Request.ServerVariables("HTTP_USER_AGENT") & vbcrlf
body=body & "Remote(usr) Ip: " &
Request.ServerVariables("REMOTE_ADDR") & vbcrlf
body=body & "Sever Ip: " &
Request.ServerVariables("LOCAL_ADDR") & vbcrlf
body=body & "Referer: " &
Request.ServerVariables("HTTP_REFERER") & vbcrlf
body=body & vbcrlf & "----------------" & vbcrlf &
"Form Info" & vbcrlf& "----------------" & vbcrlf
body=body & vbcrlf & "Lang: " &
Request.item("Language") & vbcrlf
'Response.Write Request.Form.Count
for x=1 to Request.Form.Count
'check if the item should be displayed (hidden)
'if item="recipient" or item="subject" or
item="redirect" or item="conformation" then
'do nothing, cause we not want it
'else
'Response.Write ("<TR><TD align=Left vAlign=top>" &
Request.Form.key(x) & ": </TD><TD>"&
Request.Form.Item(x) &"</TD></TR>")
body=body & Request.Form.Key(x) & ": " &
Request.Form.item(x) & vbCrLf
'body = body & item & ": " & Request.Form(item) &
vbcrlf
if Request.Form.key(x)="E-mail" or
Request.Form.key(x)="e-mail" or
Request.Form.key(x)="email" or
Request.Form.key(x)="Email" then
efrom=Request.Form.item(x)
next
'Response.Write body
rec=Request.item("recipient")
subj=Request.Item("subject")
'set the email from if we have one !
if efrom="" then efrom="WebDesign at ingla.com"
sendmail rec, efrom, subj, body,
"",Request.Item("lang"),"",""
if Request("to_friend")="y" then
' Response.Write body
select case ucase(Request("Language"))
case "EN"
if request("email1") <> "" then
efrom="WebDesign at ingla.com"
subj=Request.item("name") & " recommends Ingla
Design"
body = "Hello " & Request("friend1")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" thinks our site will
interest you. Please take a minute and visit us." &
vbCrLf & vbCrLf &"You will be able to view the site if
you visit" & vbcrlf & vbcrlf
&"http://design.ingla.com"
rec=Request("email1")
sendmail rec, efrom, subj, body, "", "EN", "",""
end if
if request("email2") <> "" then
efrom="WebDesign at ingla.com"
subj=Request.item("name") & " recommends Ingla
Design"
body = "Hello " & Request("friend2")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" thinks our site will
interest you. Please take a minute and visit us." &
vbCrLf & vbCrLf &"You will be able to view the site if
you visit" & vbcrlf & vbcrlf
&"http://design.ingla.com"
rec=Request("email2")
sendmail rec, efrom, subj, body, "", "EN", "",""
end if
if request("email3") <> "" then
efrom="WebDesign at ingla.com"
subj=Request.item("name") & " recommends Ingla
Design"
body = "Hello " & Request("friend3")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" thinks our site will
interest you. Please take a minute and visit us." &
vbCrLf & vbCrLf &"You will be able to view the site if
you visit" & vbcrlf & vbcrlf
&"http://design.ingla.com"
rec=Request("email3")
sendmail rec, efrom, subj, body, "", "EN", "",""
end if
case "HE"
'DAVID do hebrew email here
if request("email1") <> "" then
efrom="forms at ingla.com"
subj="מציע את
אתרנו "&
Request.item("name")
body = "שלום " &
Request("friend1")& vbCrLf & vbCrLf &
Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה" & vbCrLf & vbCrLf
&"www.ingla.com"
rec=Request("email1")
'sendmail rec, efrom, subj, body, "", "HE", "",""
'and now in html
body="<HTML lang='he' dir='rtl'>"_
&"<BODY bgcolor='white' text='black' link='blue'
vlink='purple' alink='red'>"_
&"<TABLE width='100%'><TR><TD align='right'>"&
Request("friend1")_
&" שלום </TD></TR>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD align='right'>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לקחת כמה
דקות
לבקר
אותנו
בכתובת
הבאה</TD></TR>"_
&"<TR><TD align='right'> </TD></TR>"_
&"<TR><TD align='right'><A
HREF='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</A></TD>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD
align='right'>להתראות</TD></TR>"_
&"</TABLE></BODY></HTML>"
' body="<html dir=rtl lang=he>"&"
שלום "& Request("friend1")_
' &"<p><br>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה "_
' &"<p><br>"&"<a
href='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</a>"
sendmail rec, efrom, subj, body, "", "HE",
"","HTML"
end if
if request("email2") <> "" then
efrom="forms at ingla.com"
subj="מציע/ה
לך את
האתר
שלנו "&Request.item("name")
body = "שלום " &
Request("friend2")& vbCrLf & vbCrLf &
Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה" & vbCrLf & vbCrLf
&"www.ingla.com"
rec=Request("email2")
'sendmail rec, efrom, subj, body, "", "HE", "",""
'and now in html
body="<HTML lang='he' dir='rtl'>"_
&"<BODY bgcolor='white' text='black' link='blue'
vlink='purple' alink='red'>"_
&"<TABLE width='100%'><TR><TD align='right'>"&
Request("friend2")_
&" שלום </TD></TR>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD align='right'>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לקחת כמה
דקות
לבקר
אותנו
בכתובת
הבאה</TD></TR>"_
&"<TR><TD align='right'> </TD></TR>"_
&"<TR><TD align='right'><A
HREF='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</A></TD>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD
align='right'>להתראות</TD></TR>"_
&"</TABLE></BODY></HTML>"
'body="<html dir=rtl lang=he>"&"
שלום "& Request("friend2")_
'&"<p><br>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה "_
'&"<p><br>"&"<a
href='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</a>"
sendmail rec, efrom, subj, body, "", "HE",
"","HTML"
end if
if request("email3") <> "" then
efrom="forms at ingla.com"
subj="מציע/ה
לך את
האתר
שלנו "&Request.item("name")
body = "שלום " &
Request("friend3")& vbCrLf & vbCrLf &
Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה" & vbCrLf & vbCrLf
&"www.ingla.com"
rec=Request("email3")
'sendmail rec, efrom, subj, body, "", "HE", "",""
'and now in html
body="<HTML lang='he' dir='rtl'>"_
&"<BODY bgcolor='white' text='black' link='blue'
vlink='purple' alink='red'>"_
&"<TABLE width='100%'><TR><TD align='right'>"&
Request("friend3")_
&" שלום </TD></TR>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD align='right'>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לקחת כמה
דקות
לבקר
אותנו
בכתובת
הבאה</TD></TR>"_
&"<TR><TD align='right'> </TD></TR>"_
&"<TR><TD align='right'><A
HREF='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</A></TD>"_
&"<TR><TD> </TD></TR>"_
&"<TR><TD
align='right'>להתראות</TD></TR>"_
&"</TABLE></BODY></HTML>"
'body="<html dir=rtl lang=he>"&"
שלום "& Request("friend3")_
'&"<p><br>"& Request.item("name") &"
חושב/ת
שהאתר
שלנו
יעניין
אותך. נא
לבקר
אותנו
בכתובת
הבאה "_
'&"<p><br>"&"<a
href='http://www.ingla.com/ivrit/index.shtm'>www.ingla.com</a>"
sendmail rec, efrom, subj, body, "", "HE",
"","HTML"
end if
case "ES"
'david do spanish eamil here
if request("email1") <> "" then
efrom="forms at ingla.com"
subj=Request.item("name") & " recomienda
www.ingla.com"
body = "Hola " & Request("friend1")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" cree que nuestro
sitio te interesarב y nos pidiף que te
enviemos esta invitaciףn."& vbCrLf & vbCrLf
&"Por favor, toma un minuto de tu tiempo y
visםtanos" & vbcrlf & vbcrlf &"www.ingla.com"
rec=Request("email1")
sendmail rec, efrom, subj, body, "", "ES", "",""
end if
if request("email2") <> "" then
efrom="forms at ingla.com"
subj=Request.item("name") & " recomienda
www.ingla.com"
body = "Hola " & Request("friend2")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" cree que nuestro
sitio te interesarב y nos pidiף que te
enviemos esta invitaciףn."& vbCrLf & vbCrLf &"
Por favor, toma un minuto de tu tiempo y
visםtanos." & vbCrLf & vbCrLf &"www.ingla.com"
rec=Request("email2")
sendmail rec, efrom, subj, body, "", "ES", "",""
end if
if request("email3") <> "" then
efrom="forms at ingla.com"
subj=Request.item("name") & " recomienda
www.ingla.com"
body = "Hola " & Request("friend3")&"!" & vbCrLf &
vbCrLf & Request.item("name") &" cree que nuestro
sitio te interesarב y nos pidiף que te
enviemos esta invitaciףn." & vbCrLf & vbCrLf
&"Por favor, toma un minuto de tu tiempo y
visםtanos" & vbcrlf & vbcrlf &"www.ingla.com"
rec=Request("email3")
sendmail rec, efrom, subj, body, "", "ES", "",""
end if
end select
Response.Redirect Request.item("redirect")
else
Response.Redirect Request.item("redirect")
end if
-->
%>
<STRONG>Thank you. Your form has been mailed.
</STRONG></P>
<P align=center>
<!--<A
HREF="<%request.ServerVariables("HTTP_REFERER")%></A>-->
</BODY>
</HTML>
------
The 2nd is: sendmailinc.asp which reads like this:
<%
dim Mail
sub sendmail(rec, from, subj, body, cc, lang, attach,
other)
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = Application("ServerAddress")
'Mail.AddAddress Request.Form("sTxtTo")
Mail.AddAddress rec
'Mail.AddAddress "WebDesign at ingla.com"
if cc<>"" then Mail.AddAddress cc
Mail.Subject=subj
if from<>"" then
Mail.From=from
else
Mail.From="WebDesign at ingla.com"
end if
if ucase(other)="HTML" then
Mail.IsHTML=TRUE
select case ucase(lang)
case "EN"
'nothing
case "ES"
Mail.AddCustomHeader("Content-Type: text/html;" &
chr(13) & " charset=""windows-1252""")
case "HE"
Mail.AddCustomHeader("Content-Type: text/html;" &
chr(13) & " charset=""windows-1255""")
end select
else
select case ucase(lang)
case "EN"
'nothing
case "ES"
Mail.CharSet="windows-1252"
case "HE"
Mail.CharSet="windows-1255"
end select
end if
Mail.Body=body
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " &
Err.Description
End If
end sub
%>
------
Any help on finding the problem would be greatly
appreciated.
Thanks.
David
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
More information about the thelist
mailing list