Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Your E-Mail Address does not appear to be valid - please make any necessary corrections.


charagg

Recommended Posts

Hi,

 

While I am suspecting that this error is related to the below mentioned contribution, I am getting this error on my registration page as well. Therefore, I thought I'd post the question here too... just in case it is not related to the contribution.

 

I installed the Contact Us Super Enhancement (great contribution with the exception of this error) on my site (OSC 2.2rc2a) with STS installed. Everything seems to work fine, but now whenever I try sending an email through the contact form, the email is sent, however an error message appears above the Enquiry sent message. The error is "Your E-Mail Address does not appear to be valid - please make any necessary corrections." I am also now receiving this message when trying to register a new account. However, in that case, the account is not created. This is a big problem that I hopefully can get resolved here.

 

Also, when a message is sent through the contact page, the following errors come up on my server's error log:

 

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: file(includes/tld.txt) [<a href='function.file'>function.file</a>]: failed to open stream: No such file or directory in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 85, referer: http://www.mywebsite.net/contact_us.php

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: Variable passed to each() is not an array or object in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 86, referer: http://www.mywebsite.net/contact_us.php

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: eregi() [<a href='function.eregi'>function.eregi</a>]: REG_EMPTY in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 97, referer: http://www.mywebsite.net/contact_us.php

 

I have searched for hours now to try and resolve this, but can't seem to find anything. Given the fact that this error is now coming up when trying to register, I have to assume that this error resides in the SQL file and not the contact_us.php file. I have also verified that "Verify e-mail address through a DNS server" in Configuration/Email Options has been set to False.

 

Can someone please help me resolve this?

 

Thanks

Link to comment
Share on other sites

Hi,

 

While I am suspecting that this error is related to the below mentioned contribution, I am getting this error on my registration page as well. Therefore, I thought I'd post the question here too... just in case it is not related to the contribution.

 

I installed the Contact Us Super Enhancement (great contribution with the exception of this error) on my site (OSC 2.2rc2a) with STS installed. Everything seems to work fine, but now whenever I try sending an email through the contact form, the email is sent, however an error message appears above the Enquiry sent message. The error is "Your E-Mail Address does not appear to be valid - please make any necessary corrections." I am also now receiving this message when trying to register a new account. However, in that case, the account is not created. This is a big problem that I hopefully can get resolved here.

 

Also, when a message is sent through the contact page, the following errors come up on my server's error log:

 

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: file(includes/tld.txt) [<a href='function.file'>function.file</a>]: failed to open stream: No such file or directory in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 85, referer: http://www.mywebsite.net/contact_us.php

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: Variable passed to each() is not an array or object in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 86, referer: http://www.mywebsite.net/contact_us.php

[sun Oct 05 16:07:03 2008] [error] [client 67.181.188.252] PHP Warning: eregi() [<a href='function.eregi'>function.eregi</a>]: REG_EMPTY in /var/www/vhosts/mywebsite.net/httpdocs/includes/functions/validations.php on line 97, referer: http://www.mywebsite.net/contact_us.php

 

I have searched for hours now to try and resolve this, but can't seem to find anything. Given the fact that this error is now coming up when trying to register, I have to assume that this error resides in the SQL file and not the contact_us.php file. I have also verified that "Verify e-mail address through a DNS server" in Configuration/Email Options has been set to False.

 

Can someone please help me resolve this?

 

Thanks

Create a file called tld.txt in the includes folder and put the following contents in it:

# $Id: tld.txt,v 1.1 2003/03/15 14:38:38 project3000 Exp $
#
# osCommerce, Open Source E-Commerce Solutions
# http://www.oscommerce.com
#
# Copyright (c) 2003 osCommerce
#
# Released under the GNU General Public License
#

# Original 7 TLDs
com	 # all are eligible to register
edu	 # degree-granting educational institutions of higher education
gov	 # United States Government
int	 # organizations established by international treaties
mil	 # United States Military
net	 # all are eligible to register
org	 # noncommercial community, all are eligible to register

# Recent additions
aero	# members of the air-transport industry
biz	 # businesses
coop	# cooperative associations
info	# all are eligible to register
museum  # museums
name	# individuals
pro	 # credentialed professionals

Link to comment
Share on other sites

Here you go... thanks for the quick replies:

 

<?php

/*

$Id: validations.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////////////////////////////////////////////////////////////////////////////////////////////////

//

// Function : tep_validate_email

//

// Arguments : email email address to be checked

//

// Return : true - valid email address

// false - invalid email address

//

// Description : function for validating email address that conforms to RFC 822 specs

//

// This function is converted from a JavaScript written by

// Sandeep V. Tamhankar ([email protected]). The original JavaScript

// is available at http://javascript.internet.com

//

// Sample Valid Addresses:

//

// [email protected]

// [email protected]

// "first last"@host.com

// "first@last"@host.com

// [email protected]

// first.last@[123.123.123.123]

//

// Invalid Addresses:

//

// first [email protected]

//

//

////////////////////////////////////////////////////////////////////////////////////////////////

function tep_validate_email($email) {

$valid_address = true;

 

$mail_pat = '^(.+)@(.+)$';

$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";

$atom = "$valid_chars+";

$quoted_user='(\"[^\"]*\")';

$word = "($atom|$quoted_user)";

$user_pat = "^$word(\.$word)*$";

$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';

$domain_pat = "^$atom(\.$atom)*$";

 

if (eregi($mail_pat, $email, $components)) {

$user = $components[1];

$domain = $components[2];

// validate user

if (eregi($user_pat, $user)) {

// validate domain

if (eregi($ip_domain_pat, $domain, $ip_components)) {

// this is an IP address

for ($i=1;$i<=4;$i++) {

if ($ip_components[$i] > 255) {

$valid_address = false;

break;

}

}

}

else {

// Domain is a name, not an IP

if (eregi($domain_pat, $domain)) {

/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD

and that there's a hostname preceding the domain or country. */

$domain_components = explode(".", $domain);

// Make sure there's a host name preceding the domain.

if (sizeof($domain_components) < 2) {

$valid_address = false;

} else {

$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);

// Allow all 2-letter TLDs (ccTLDs)

if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {

$tld_pattern = '';

// Get authorized TLDs from text file

$tlds = file(DIR_WS_INCLUDES . 'tld.txt');

while (list(,$line) = each($tlds)) {

// Get rid of comments

$words = explode('#', $line);

$tld = trim($words[0]);

// TLDs should be 3 letters or more

if (eregi('^[a-z]{3,}$', $tld) == 1) {

$tld_pattern .= '^' . $tld . '$|';

}

}

// Remove last '|'

$tld_pattern = substr($tld_pattern, 0, -1);

if (eregi("$tld_pattern", $top_level_domain) == 0) {

$valid_address = false;

}

}

}

}

else {

$valid_address = false;

}

}

}

else {

$valid_address = false;

}

}

else {

$valid_address = false;

}

if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') {

if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) {

$valid_address = false;

}

}

return $valid_address;

}

?>

Link to comment
Share on other sites

Code for Contact Us page... just in case you need this too:

 

<?php

/*

$Id: contact_us.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 

$error = false;

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);

// BOF Super Contact us enhancement 1.41

$order_id = tep_db_prepare_input($HTTP_POST_VARS['order_id']);

if ($order_id <> NULL){

$enquiry = 'Order ID: ' . $order_id . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}else{

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}

 

$emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT;

if (tep_validate_email($email_address)) {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address);

if (CONTACT_US_LIST !=''){

$send_to_array=explode("," ,CONTACT_US_LIST);

preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);

$send_to_email= eregi_replace (">", "", $send_email_array[0]);

$send_to_email= eregi_replace ("<", "", $send_to_email);

 

tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address);

}else{

//tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));

tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=send'));

}

// EOF Super Contact us enhancement 1.41

} else {

$error = true;

 

$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

}

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($messageStack->size('contact') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('contact'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

 

?>

<tr>

<td class="main" align="center"> <?php echo TEXT_SUCCESS; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<!-- BOF Super Contact us enhancement 1.41 //-->

<?php

} else {

if (tep_session_is_registered('customer_id')) {

$account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$account = tep_db_fetch_array($account_query);

 

$name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];

$email = $account['customers_email_address'];

}

?>

<tr><td>

 

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents"><td><table><tr>

<td class="main" valign="top" width=40%><b><?php echo nl2br(STORE_NAME_ADDRESS); ?></b><br><br>

<?php echo (OPENING_HOURS); ?><br><br></td>

<td class="main" valign="top" width="60%"><?php echo ENTRY_NAME; ?><br>

<?php echo tep_draw_input_field('name'); ?><br />

<?php echo ENTRY_EMAIL; ?><br>

<?php echo tep_draw_input_field('email'); ?><br />

<?php echo ENTRY_ORDER_ID; ?><br>

<?php echo tep_draw_input_field('order_id'); ?><br />

<?php

if (CONTACT_US_LIST !=''){

echo SEND_TO_TEXT . '<br>';

if(SEND_TO_TYPE=='radio'){

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

if($k==0){

$checked=true;

}else{

$checked=false;

}

echo tep_draw_radio_field('send_to', "$k", $checked). " " .preg_replace('/\<[^*]*/', '', $v);

}

 

}else{

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

$send_to_array[] = array('id' => $k, 'text' => preg_replace('/\<[^*]*/', '', $v));

}

echo tep_draw_pull_down_menu('send_to', $send_to_array);

}

 

echo('<br>');

}

?>

<?php echo ENTRY_REASON; ?><br>

<select name="reason">

<?php echo '<option value="' . REASONS1 . '">' . REASONS1 . '</option>'; ?>

<?php echo '<option value="' . REASONS2 . '">' . REASONS2 . '</option>'; ?>

<?php echo '<option value="' . REASONS3 . '">' . REASONS3 . '</option>'; ?>

<?php echo '<option value="' . REASONS4 . '">' . REASONS4 . '</option>'; ?>

</select><br />

<?php echo ENTRY_ENQUIRY; ?><BR>

<?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, tep_sanitize_string($_POST['enquiry']), '', false); ?>

<br />

</td></tr></table></td>

</tr>

</table>

<br />

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td></tr>

<?php

}

?>

<!-- EOF Super Contact us enhancement 1.41 //-->

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Here you go... thanks for the quick replies:

 

<?php

/*

$Id: validations.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////////////////////////////////////////////////////////////////////////////////////////////////

//

// Function : tep_validate_email

//

// Arguments : email email address to be checked

//

// Return : true - valid email address

// false - invalid email address

//

// Description : function for validating email address that conforms to RFC 822 specs

//

// This function is converted from a JavaScript written by

// Sandeep V. Tamhankar ([email protected]). The original JavaScript

// is available at http://javascript.internet.com

//

// Sample Valid Addresses:

//

// [email protected]

// [email protected]

// "first last"@host.com

// "first@last"@host.com

// [email protected]

// first.last@[123.123.123.123]

//

// Invalid Addresses:

//

// first [email protected]

//

//

////////////////////////////////////////////////////////////////////////////////////////////////

function tep_validate_email($email) {

$valid_address = true;

 

$mail_pat = '^(.+)@(.+)$';

$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";

$atom = "$valid_chars+";

$quoted_user='(\"[^\"]*\")';

$word = "($atom|$quoted_user)";

$user_pat = "^$word(\.$word)*$";

$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';

$domain_pat = "^$atom(\.$atom)*$";

 

if (eregi($mail_pat, $email, $components)) {

$user = $components[1];

$domain = $components[2];

// validate user

if (eregi($user_pat, $user)) {

// validate domain

if (eregi($ip_domain_pat, $domain, $ip_components)) {

// this is an IP address

for ($i=1;$i<=4;$i++) {

if ($ip_components[$i] > 255) {

$valid_address = false;

break;

}

}

}

else {

// Domain is a name, not an IP

if (eregi($domain_pat, $domain)) {

/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD

and that there's a hostname preceding the domain or country. */

$domain_components = explode(".", $domain);

// Make sure there's a host name preceding the domain.

if (sizeof($domain_components) < 2) {

$valid_address = false;

} else {

$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);

// Allow all 2-letter TLDs (ccTLDs)

if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {

$tld_pattern = '';

// Get authorized TLDs from text file

$tlds = file(DIR_WS_INCLUDES . 'tld.txt');

while (list(,$line) = each($tlds)) {

// Get rid of comments

$words = explode('#', $line);

$tld = trim($words[0]);

// TLDs should be 3 letters or more

if (eregi('^[a-z]{3,}$', $tld) == 1) {

$tld_pattern .= '^' . $tld . '$|';

}

}

// Remove last '|'

$tld_pattern = substr($tld_pattern, 0, -1);

if (eregi("$tld_pattern", $top_level_domain) == 0) {

$valid_address = false;

}

}

}

}

else {

$valid_address = false;

}

}

}

else {

$valid_address = false;

}

}

else {

$valid_address = false;

}

if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') {

if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) {

$valid_address = false;

}

}

return $valid_address;

}

?>

Hmm... what email address are your using?

Link to comment
Share on other sites

The reason for the first error is that you tried to register with an email address based on the domain the site is hosted on - use a different email address and you'll be able to register. Either that or you were using a type of domain not listed in the tld file - and so not recognised. For instance .mobi domains are not in the list.

 

Vger

Link to comment
Share on other sites

The reason for the first error is that you tried to register with an email address based on the domain the site is hosted on - use a different email address and you'll be able to register. Either that or you were using a type of domain not listed in the tld file - and so not recognised. For instance .mobi domains are not in the list.

 

Vger

 

Unfortunately, I will have to disagree. Adding the tld.txt file to the includes/ directory seemed to fix the registration problem. I am using a .net email address in both instances. However, I tried the registration using .com and .net addresses that are all valid... but again, that issue was resolved by adding the tld.txt file. As far as not being able to register with the same email address that is used for site admin - this is not correct either, as I had already done this prior to this issue coming up without any problems. I have done this for other sites that I have buildt with no issues either.

 

The problem still remains with the contact us form. I've tried both .com and .net addresses that are valid.

 

Any thoughts on this?

Link to comment
Share on other sites

Unfortunately, I will have to disagree. Adding the tld.txt file to the includes/ directory seemed to fix the registration problem. I am using a .net email address in both instances. However, I tried the registration using .com and .net addresses that are all valid... but again, that issue was resolved by adding the tld.txt file. As far as not being able to register with the same email address that is used for site admin - this is not correct either, as I had already done this prior to this issue coming up without any problems. I have done this for other sites that I have buildt with no issues either.

 

The problem still remains with the contact us form. I've tried both .com and .net addresses that are valid.

 

Any thoughts on this?

Anything new in your error logs?

Link to comment
Share on other sites

That is your validations.php file. Please post the contents of your contact_us.php file.

 

Post #7 is the code for my Contact Us page, I posted it right after the Validation.php code. Here it is again:

 

----------------------------------------------------START--------------------------------------------------------

<?php

/*

$Id: contact_us.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 

$error = false;

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);

// BOF Super Contact us enhancement 1.41

$order_id = tep_db_prepare_input($HTTP_POST_VARS['order_id']);

if ($order_id <> NULL){

$enquiry = 'Order ID: ' . $order_id . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}else{

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}

 

$emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT;

if (tep_validate_email($email_address)) {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address);

if (CONTACT_US_LIST !=''){

$send_to_array=explode("," ,CONTACT_US_LIST);

preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);

$send_to_email= eregi_replace (">", "", $send_email_array[0]);

$send_to_email= eregi_replace ("<", "", $send_to_email);

 

tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address);

}else{

//tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));

tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=send'));

}

// EOF Super Contact us enhancement 1.41

} else {

$error = true;

 

$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

}

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($messageStack->size('contact') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('contact'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

 

?>

<tr>

<td class="main" align="center"> <?php echo TEXT_SUCCESS; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<!-- BOF Super Contact us enhancement 1.41 //-->

<?php

} else {

if (tep_session_is_registered('customer_id')) {

$account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$account = tep_db_fetch_array($account_query);

 

$name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];

$email = $account['customers_email_address'];

}

?>

<tr><td>

 

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents"><td><table><tr>

<td class="main" valign="top" width=40%><b><?php echo nl2br(STORE_NAME_ADDRESS); ?></b><br><br>

<?php echo (OPENING_HOURS); ?><br><br></td>

<td class="main" valign="top" width="60%"><?php echo ENTRY_NAME; ?><br>

<?php echo tep_draw_input_field('name'); ?><br />

<?php echo ENTRY_EMAIL; ?><br>

<?php echo tep_draw_input_field('email'); ?><br />

<?php echo ENTRY_ORDER_ID; ?><br>

<?php echo tep_draw_input_field('order_id'); ?><br />

<?php

if (CONTACT_US_LIST !=''){

echo SEND_TO_TEXT . '<br>';

if(SEND_TO_TYPE=='radio'){

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

if($k==0){

$checked=true;

}else{

$checked=false;

}

echo tep_draw_radio_field('send_to', "$k", $checked). " " .preg_replace('/\<[^*]*/', '', $v);

}

 

}else{

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

$send_to_array[] = array('id' => $k, 'text' => preg_replace('/\<[^*]*/', '', $v));

}

echo tep_draw_pull_down_menu('send_to', $send_to_array);

}

 

echo('<br>');

}

?>

<?php echo ENTRY_REASON; ?><br>

<select name="reason">

<?php echo '<option value="' . REASONS1 . '">' . REASONS1 . '</option>'; ?>

<?php echo '<option value="' . REASONS2 . '">' . REASONS2 . '</option>'; ?>

<?php echo '<option value="' . REASONS3 . '">' . REASONS3 . '</option>'; ?>

<?php echo '<option value="' . REASONS4 . '">' . REASONS4 . '</option>'; ?>

</select><br />

<?php echo ENTRY_ENQUIRY; ?><BR>

<?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, tep_sanitize_string($_POST['enquiry']), '', false); ?>

<br />

</td></tr></table></td>

</tr>

</table>

<br />

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td></tr>

<?php

}

?>

<!-- EOF Super Contact us enhancement 1.41 //-->

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

-------------------------------------------------------------END-------------------------------------------------------------

 

Thanks for your efforts... hopefully we can resolve this.

Link to comment
Share on other sites

Post #7 is the code for my Contact Us page, I posted it right after the Validation.php code. Here it is again:

 

----------------------------------------------------START--------------------------------------------------------

<?php

/*

$Id: contact_us.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 

$error = false;

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);

// BOF Super Contact us enhancement 1.41

$order_id = tep_db_prepare_input($HTTP_POST_VARS['order_id']);

if ($order_id <> NULL){

$enquiry = 'Order ID: ' . $order_id . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}else{

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}

 

$emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT;

if (tep_validate_email($email_address)) {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address);

if (CONTACT_US_LIST !=''){

$send_to_array=explode("," ,CONTACT_US_LIST);

preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);

$send_to_email= eregi_replace (">", "", $send_email_array[0]);

$send_to_email= eregi_replace ("<", "", $send_to_email);

 

tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address);

}else{

//tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));

tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=send'));

}

// EOF Super Contact us enhancement 1.41

} else {

$error = true;

 

$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

}

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($messageStack->size('contact') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('contact'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

 

?>

<tr>

<td class="main" align="center"> <?php echo TEXT_SUCCESS; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<!-- BOF Super Contact us enhancement 1.41 //-->

<?php

} else {

if (tep_session_is_registered('customer_id')) {

$account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$account = tep_db_fetch_array($account_query);

 

$name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];

$email = $account['customers_email_address'];

}

?>

<tr><td>

 

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents"><td><table><tr>

<td class="main" valign="top" width=40%><b><?php echo nl2br(STORE_NAME_ADDRESS); ?></b><br><br>

<?php echo (OPENING_HOURS); ?><br><br></td>

<td class="main" valign="top" width="60%"><?php echo ENTRY_NAME; ?><br>

<?php echo tep_draw_input_field('name'); ?><br />

<?php echo ENTRY_EMAIL; ?><br>

<?php echo tep_draw_input_field('email'); ?><br />

<?php echo ENTRY_ORDER_ID; ?><br>

<?php echo tep_draw_input_field('order_id'); ?><br />

<?php

if (CONTACT_US_LIST !=''){

echo SEND_TO_TEXT . '<br>';

if(SEND_TO_TYPE=='radio'){

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

if($k==0){

$checked=true;

}else{

$checked=false;

}

echo tep_draw_radio_field('send_to', "$k", $checked). " " .preg_replace('/\<[^*]*/', '', $v);

}

 

}else{

foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {

$send_to_array[] = array('id' => $k, 'text' => preg_replace('/\<[^*]*/', '', $v));

}

echo tep_draw_pull_down_menu('send_to', $send_to_array);

}

 

echo('<br>');

}

?>

<?php echo ENTRY_REASON; ?><br>

<select name="reason">

<?php echo '<option value="' . REASONS1 . '">' . REASONS1 . '</option>'; ?>

<?php echo '<option value="' . REASONS2 . '">' . REASONS2 . '</option>'; ?>

<?php echo '<option value="' . REASONS3 . '">' . REASONS3 . '</option>'; ?>

<?php echo '<option value="' . REASONS4 . '">' . REASONS4 . '</option>'; ?>

</select><br />

<?php echo ENTRY_ENQUIRY; ?><BR>

<?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, tep_sanitize_string($_POST['enquiry']), '', false); ?>

<br />

</td></tr></table></td>

</tr>

</table>

<br />

<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td></tr>

<?php

}

?>

<!-- EOF Super Contact us enhancement 1.41 //-->

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

-------------------------------------------------------------END-------------------------------------------------------------

 

Thanks for your efforts... hopefully we can resolve this.

Link to comment
Share on other sites

Made somewhat of a breakthrough... sort of. The contribution has a feature which allows you to setup radio buttons on the contact form in order to have the email routed to different emails/departments. When these are setup, which I just did, the error no longer appears when the message is sent. When removed so that emails go to the default contact email, the message appears. FYI I used the default email address for one of the departments, so I know that it's not the email address. However, with the Contact Us Email List option enabled, as I have it now, all the emails still go to the default address. I'm thinking that this post should probably be moved to the contribution's thread. However, I don't know how to do this and that thread doesn't seem to have had any activity for months. Looks like I'm getting better help here. Please advise. Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...