Contact Page, add user fields |
Post Reply | Page 12> |
Author | |
mthierfelder
Newbie Joined: 22-December-2008 Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 15-April-2009 at 12:11am |
I am trying to add "Company" and "Phone Number" as user filled in forms to the contact page. I had it working, then we switched servers and its not working in that no email ever gets sent.
I'm not an ASP whiz by any means, I just copied some of the logic for other fields. I did add eng_Contact_11 and eng_Contact_12 to languages.asp as "Your Company" and "Your Phone". Then of course added the two fields to the contact.asp page like so: <tr> Please offer pointers if you can, here is the code snippet I'm using (the red code is what I modified/added) on the contact.asp page: '///////////////////////////////////////////////////// |
|
Hamish
Admin Group Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
Post Options
Thanks(0)
|
Hi,
Unless you have also changed includes/sendmail.asp you will need to revert that line to it's original text as it only takes 5 parameters. call sendmail (CustName,CustEmail,scFrmEmail,MsgTitle,MsgBody) The phone and company name have already been incorporated into the message body. Edited by Hamish - 15-April-2009 at 4:40am |
|
Hamish
Admin Group Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
Post Options
Thanks(0)
|
If you had modified sendmail as well and that's not the problem, check that ANY emails are being sent. You can do this from the control panel "settings > Email Settings : Test your settings". I would also advise checking "Help > Troubleshooting utility" whenever a major change such as switching servers has occurred (along with other testing).
|
|
mthierfelder
Newbie Joined: 22-December-2008 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
I had not modified sendmail. I took a look at it and am not seeing the variables that are present in contact.asp. For instance contact.asp calls the message MsgText, but sendmail calls it BodyText. Also, I don't see any reference in sendmail.asp to CustName, or CustEmail. Could you be more specific as to how I add in the two new fields to sendmail? We are using CDOSYS for our mailer...this is the block:
Function sendMail(fromName, from, rcpt, subject, body) if scEmailComObj="CDOSYS" then Dim mail Dim iConf Dim Flds 'on error resume next Set mail = CreateObject("CDO.Message") 'calls CDO message COM object Set iConf = CreateObject("CDO.Configuration") 'calls CDO configuration COM object Set Flds = iConf.Fields Flds( "http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 'tells cdo we're using the local smtp service, use "2" if not local Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")=scSMTP Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 Flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 20 Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" 'verify that this path is correct Flds.Update 'updates CDO's configuration database 'if smtp authentication is required '================================== if scSMTPAuthentication="Y" then Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ' cdoBasic Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = scSMTPUID Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = scSMTPPWD Flds.Update 'updates CDO's configuration database end if '================================== Set mail.Configuration = iConf 'sets the configuration for the message mail.To = rcpt mail.From = from mail.Subject = subject If session("News_MsgType")="1" Then HTMLBody=HTML mail.HTMLBody = body Else TextBody=Plain mail.TextBody = body End If mail.Send 'commands CDO to send the message if err then pcv_errMsg = err.Description end if set mail=nothing End If |
|
Hamish
Admin Group Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
Post Options
Thanks(0)
|
Hi,
The parameters passed are positional, so the value of "msgText" is passed to Sendmail into variable "body". You don't need to, in fact should not, change the sendmail code. The phone number and company name will appear in the text of the message due to the other changes you have done. |
|
mthierfelder
Newbie Joined: 22-December-2008 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
Ok, so if I understand correctly you are saying that messages should be sending given the changes I have made, and the company and phone should be passed in that email? because the messages are not being sent right now.
I have tested the sendmail in the admin and it is working. The default contact.asp page does work and sends mail but still having trouble getting the two new fields going. |
|
Hamish
Admin Group Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
Post Options
Thanks(0)
|
Hi,
Just a thought, did you add other lines of code, such as setting the pcv_isPhoneRequired and calling pcs_ValidateTextField for the two new fields? |
|
mthierfelder
Newbie Joined: 22-December-2008 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
Do you mean like this?:
pcv_isNameRequired=True pcv_isEmailRequired=True pcv_isTitleRequired=True pcv_isBodyRequired=True 'New fields added to contact form pcv_isCompanyRequired=False pcv_isPhoneRequired=False if request.form("updatemode")="1" then '//set error to zero pcv_intErr=0 pcs_ValidateEmailField "FromEmail", pcv_isEmailRequired, 0 pcs_ValidateTextField "FromName", pcv_isNameRequired, 0 pcs_ValidateTextField "MsgTitle", pcv_isTitleRequired, 0 pcs_ValidateTextField "MsgBody", pcv_isBodyRequired, 0 'New fields added to contact form pcs_ValidateTextField "FromPhone", pcv_isPhoneRequired, 0 pcs_ValidateTextField "FromCompany", pcv_isCompanyRequired, 0 Edited by mthierfelder - 15-April-2009 at 11:50am |
|
mthierfelder
Newbie Joined: 22-December-2008 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
I figured it out. On this line:
call sendmail (CustName,CustEmail,scFrmEmail,MsgTitle,MsgBody) I had added CustPhone,CustCompany which didn't work, I think because sendmail didn't know what to do with those two things since it only has the original 5 variables. Anyway thanks for your support. |
|
Hamish
Admin Group Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
Post Options
Thanks(0)
|
That's just what I said to do in my first post :-)
|
|
Post Reply | Page 12> |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |