|
 |
access_asp thread: apostrophe fix for email- resend
Message #1 by "Spencer Saunders" <ssaunders@i...> on Wed, 29 Aug 2001 13:26:09 -0400
|
|
Hello,
I am reposting this message as it seems that my last message was translated
to the list rather strangely and did not include some of my code,.
I am trying to set up an "email this to a friend" function and everything is
fine until the contents of the message contain an apostrophe. I have a
function to replace apostrophe's but it doesn't seem to help a the case
where the variable is in the body of an email.
Any ideas??
CODE:::::::::::::
' FUNCTION TO FX THE APOSTROPHE PROBLEM
FUNCTION theFIX(variable)
theFIX=Replace(variable, "'", "''")
END FUNCTION
DIM varaction
DIM thebody
varaction=request.form("action")
thebody=Request.form("txtBody")
Set iConf = CreateObject _
("CDO.Configuration")
Set Flds = iConf.Fields
'Set and update fields properties
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.mailserver.net"
Flds.Update
Set iMesg = CreateObject("CDO.Message")
Set iMesg.Configuration = iConf
'Format and send message
Err.Clear
iMesg.To = Request.Form("txtTo")
iMesg.From = Request.Form("txtFrom")
iMesg.Subject = Request.Form("txtSubject")
iMesg.TextBody = theFIX(thebody)
iMesg.Send
If Err.Number = 0 Then
Result = "Message sent"
if varaction="send" then
DIM vargoto
vargoto=request.form("whereFrom")
response.write "The article has been mailed to "& Request.form("txtTo")
response.write "<br>This page will refresh to the article in 5 seconds."
'response.redirect vargoto
end if
Else
Result = "Message not sent"
response.write"<b>"& Ucase(Result) &"</b>"
response.write"<br>Please check to make sure that you have entered a valid
mail address."
response.write"<br>This page will refresh to the article in 5 seconds"
End If
TIA
Spencer
===============================::
===============================::
Message #2 by patrick.frenette@s... on Thu, 30 Aug 2001 12:35:01
|
|
Hi,
Try to run theFix function before assigning your text to your mail.body. I
already had some errors like this. This might help or it might not. Good
luck, let me know if it works...
Patrick
>
> Hello,
>
> I am reposting this message as it seems that my last message was
translated
> to the list rather strangely and did not include some of my code,.
>
> I am trying to set up an "email this to a friend" function and
everything is
> fine until the contents of the message contain an apostrophe. I have a
> function to replace apostrophe's but it doesn't seem to help a the case
> where the variable is in the body of an email.
>
> Any ideas??
>
> CODE:::::::::::::
>
>
> ' FUNCTION TO FX THE APOSTROPHE PROBLEM
> FUNCTION theFIX(variable)
> theFIX=Replace(variable, "'", "''")
> END FUNCTION
>
> DIM varaction
> DIM thebody
> varaction=request.form("action")
> thebody=Request.form("txtBody")
>
> Set iConf = CreateObject _
> ("CDO.Configuration")
> Set Flds = iConf.Fields
>
> 'Set and update fields properties
> Flds(cdoSendUsingMethod) = cdoSendUsingPort
> Flds(cdoSMTPServer) = "mail.mailserver.net"
> Flds.Update
>
> Set iMesg = CreateObject("CDO.Message")
> Set iMesg.Configuration = iConf
>
> 'Format and send message
> Err.Clear
>
> iMesg.To = Request.Form("txtTo")
> iMesg.From = Request.Form("txtFrom")
> iMesg.Subject = Request.Form("txtSubject")
> iMesg.TextBody = theFIX(thebody)
> iMesg.Send
>
> If Err.Number = 0 Then
> Result = "Message sent"
> if varaction="send" then
> DIM vargoto
> vargoto=request.form("whereFrom")
> response.write "The article has been mailed to "& Request.form("txtTo")
> response.write "<br>This page will refresh to the article in 5
seconds."
> 'response.redirect vargoto
> end if
>
> Else
> Result = "Message not sent"
> response.write"<b>"& Ucase(Result) &"</b>"
> response.write"<br>Please check to make sure that you have entered a
valid
> mail address."
> response.write"<br>This page will refresh to the article in 5 seconds"
>
> End If
>
> TIA
>
> Spencer
> ===============================::
> ===============================::
>
Message #3 by "Spencer Saunders" <ssaunders@i...> on Thu, 30 Aug 2001 22:37:11 -0400
|
|
That did it Patrick.
I had to stuff the problematic record from the DB into a variable- then run
theFIX function on that- all before the info was sent to the email template.
SO the fix function was actually being run on the wrong template all
together.
Thanks for the advice
spence
----- Original Message -----
From: <patrick.frenette@s...>
To: Access ASP <access_asp@p...>
Sent: August 30, 2001 12:35 PM
Subject: [access_asp] Re: apostrophe fix for email- resend
> Hi,
>
> Try to run theFix function before assigning your text to your mail.body. I
> already had some errors like this. This might help or it might not. Good
> luck, let me know if it works...
>
> Patrick
>
>
|
|
 |