Jump to content

Archived

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

multimixer

Email issues

Recommended Posts

I worked out some solutions for mails, they are already posted all around the forum, now I want to share them in a organized way. I hope somebody will find this useful.

 

A. How to get a notification when a person register.

 

1) Set up the "extra order emails" feature in Admin/my store

 

2) In file catalog/create_account.php

 

Find the lines

email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

Place after

 // BOF multimixer 24.6.2009 send emails to other people
  $owners_text = EMAIL_TEXT_OWNER_INFO . "\r\n" .EMAIL_TEXT_CUSTOMER_NAME . ' ' . $name . "\r\n" . EMAIL_TEXT_CUSTOMER_EMAIL . ' ' .  $email_address . "\r\n" . EMAIL_TEXT_CUSTOMER_PHONE . ' ' . $telephone . "\r\n" . EMAIL_TEXT_CUSTOMER_ADDRESS . ' ' . $street_address . "\r\n" . EMAIL_TEXT_CUSTOMER_CITY . ' ' . $city . "\r\n" . EMAIL_TEXT_CUSTOMER_STATE . ' ' . $state . "\r\n" . EMAIL_TEXT_CUSTOMER_COUNTRY . ' ' . $country;

  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_OWNER_SUBJECT, $owners_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 // EOF multimixer

 

3) In file catalog/includes/laguages/yourlanguage/create_account.php

 

Put before the end

// mm 24.6.09
define('EMAIL_OWNER_SUBJECT', 'New registration' );
define('EMAIL_TEXT_OWNER_INFO', 'New customer registration, find details below:');
define('EMAIL_TEXT_CUSTOMER_NAME', 'Name:' );
define('EMAIL_TEXT_CUSTOMER_EMAIL', 'email:' );
define('EMAIL_TEXT_CUSTOMER_PHONE', 'Phone:' );
define('EMAIL_TEXT_CUSTOMER_ADDRESS', 'Address:');
define('EMAIL_TEXT_CUSTOMER_CITY', 'City:' );
define('EMAIL_TEXT_CUSTOMER_STATE', 'State:');
define('EMAIL_TEXT_CUSTOMER_COUNTRY', 'Country:');

This will send an email to the additional email as set in admin for every new customer registration.

 

Because you don't want to read each time the "hello bla bla" text that the customer receives, it contains just the useful information, name, email etc

Share this post


Link to post
Share on other sites

B. What to do if you don't receive mails send via the contact us form

 

In the most of the cases, there is the host involved, who doesn't permit mails to be send from your site having as a "sender" somebody'w else mail address. Thats the way it is defined in osc

 

What to do?

 

1) in file catalog/contact_us.php

 

Find the code

if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

 

Replace it with

// BOF multimixer//
//define variable $email_body//
$email_body = $enquiry . "\r\n" . $name . "\r\n" . $email_address;
// if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them acourdingly//
//define variable $from_email. Set to Store owner email address as defined in Admin panel//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

 

The mail of the contact us form is send by the store owners mail address and not from the customers. You receive the customers mail in the mail body. This should solve the hosting mail problems (works for yahoo for sure)

Share this post


Link to post
Share on other sites

C. How to add extra fields to the contact us form?

 

Lets say you want to add the customers phone to the form

 

1) In catalog/contact_us.php

find the code

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']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

replace it with

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']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$phone = tep_db_prepare_input($HTTP_POST_VARS['phone']); // add phone 21.6.09
// BOF multimixer//
//define variable $email_body.  if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them accordingly//
$email_body = EMAIL_TEXT_CUSTOMER_NAME . ' ' . $name . "\r\n" . EMAIL_TEXT_CUSTOMER_EMAIL . ' ' .  $email_address . "\r\n" . EMAIL_TEXT_CUSTOMER_PHONE . ' ' . $phone . "\r\n" . EMAIL_TEXT_CUSTOMER_MESSAGE . ' ' . $enquiry;
//define variable $from_email. Set to Store owner email address as defined in Admin panel. If you want mails to be sent from customers mail address, set it to email_address//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

 

2) In the same file,

find the code

<tr>
			<td class="main"><?php echo ENTRY_EMAIL; ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
		  </tr>

add after

 <tr>
			<td class="main"><?php echo ENTRY_PHONE; ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_input_field('phone'); ?></td>
		  </tr>

 

3) In file includes/languages/yourlanguage/contact_us.php add anywhere befote last ?>

// mm 23.6.2009
define('EMAIL_TEXT_CUSTOMER_NAME', 'Name:');
define('EMAIL_TEXT_CUSTOMER_EMAIL', 'email:');
define('EMAIL_TEXT_CUSTOMER_PHONE', 'Phone:');
define('EMAIL_TEXT_CUSTOMER_MESSAGE', 'Message:');

 

You will have the phone in the form, and the phone send by email. In this configurations mails are send from Store owners mail address, but you can change this

Share this post


Link to post
Share on other sites

D. How to add customers phone and email into the order confirmation email? This solution also puts text at the top and bottom of the mail, the customers comments go to the bottom of the mail and there is a customer greeting instead of the store name

 

1) in file catalog/checkout_process.php find the part that refers to the email. Changes to the original code are marked with BOf/EOF

// lets start with the email confirmation
//BOF Multimixer 21.6.09
//$email_order = STORE_NAME . "\n\n" .
 $email_order .= EMAIL_TEXT_CUSTOMER_GREETING . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n\n".
			   EMAIL_TEXT_GREETING . "\n" .
//EOF Multimixer
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }
 //BOF Multimixer 19.6.09
 $email_order .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_order .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";
 // EOF Multimixer


 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n";
 //BOF Multimixer 19.6.09
 $email_order .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_order .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";
 // EOF Multimixer
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $order->info['payment_method'] . "\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }
 //BOF Multimixer 19.6.09
 if ($order->info['comments']) {
$email_order .= EMAIL_TEXT_CUSTOMER_COMMENT . "\n".
				EMAIL_SEPARATOR . "\n".
				tep_db_output($order->info['comments']) . "\n\n";
 }
  $email_order .= EMAIL_TEXT_SIGNATURE . "\n";
//EOF Multimixer


 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

2) Find the file catalog/includes/languages/yourlanguage/checkout_process.php

 

Add before the end

//BOF Multimixer 19.6.09
define('EMAIL_TEXT_CUSTOMER_TELEPHONE', 'Telephone:');
define('EMAIL_TEXT_CUSTOMER_MAIL', 'email:');
define('EMAIL_TEXT_GREETING', 'Thank you for choosing Aquamed. In this mail you will find all information about your order. For more information, please click on "Detailed Invoice". ');
define('EMAIL_TEXT_SIGNATURE', 'Please do not delete this email until you get your order delivered. For any question regarding your order please reply to this email and don\'t send a new one. It contains information that will enable us to hadle your request faster.');
define('EMAIL_TEXT_CUSTOMER_COMMENT', 'Your comments:');
define('EMAIL_TEXT_CUSTOMER_GREETING', 'Dear');
//EOF Multimixer

Share this post


Link to post
Share on other sites

E. How to add a customer greeting to the order status email?

 

1) In admin/orders.php

 

Find the lines

$email = EMAIL_TEXT_CUSTOMER_GREETING . ' ' . $customers_name . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

Add before

//BOF multimixerm 22.6.09			
		$customers_name = $check_status ['customers_name'];
// EOF multimixerm

 

2) In admin/includes/languages/yourlanguage/orders.php

 

Add before the end

// mm
define('EMAIL_TEXT_CUSTOMER_GREETING', 'Dear');

Share this post


Link to post
Share on other sites

F. New order email: How to receive a different content on the store owner side.

 

Lets say you have your "thank you for ordering mail" stuffed with alot of text and instructions etc. Do you want to read this each time a customer orders? Maybe you send this mail to your warehouse and you don't want to have this bla bla each time.

 

This here sends just the useful information. It includes also the customer ID into the strore owners version of the mail, can be useful.

 

1) In file catalog/checkout_process.php

 

Find following lines. Attention, do not mix with the original tep mail function that is sending mails to customers

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 

Replace it with this

// BOF Multimixer 25.6.2009. send emails to other people

 $email_store .= EMAIL_TEXT_STORE_INTRO . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  EMAIL_TEXT_STORE_CUSTOMER . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n".
			  EMAIL_TEXT_CUSTOMER_ID . ' ' . $customer_id . "\n" .
			  EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			  EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			  EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 $email_store .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$email_store .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_store .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_store .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_store .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";


 $email_store .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n";

 $email_store .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_store .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";

 if (is_object($$payment)) {
$email_store .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_store .= $order->info['payment_method'] . "\n\n";
if ($payment_class->email_footer) { 
  $email_store .= $payment_class->email_footer . "\n\n";
}
 }
 if ($order->info['comments']) {
$email_store .= EMAIL_TEXT_CUSTOMERS_COMMENT . "\n".
				EMAIL_SEPARATOR . "\n".
				tep_db_output($order->info['comments']) . "\n\n";
 }



 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_STORE_SUBJECT, $email_store, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 //EOF

 

2) In file catalog/includes/languages/yourlanguage/checkout_process.php

 

Add following lines before the end

// Added for store version of mail
define('EMAIL_TEXT_STORE_CUSTOMER', 'Customer:');
define('EMAIL_TEXT_STORE_INTRO', 'New order details:');
define('EMAIL_TEXT_CUSTOMER_ID', 'Customer ID:');
define('EMAIL_TEXT_STORE_SUBJECT', 'New Order');
define('EMAIL_TEXT_CUSTOMERS_COMMENT', 'Customers Coments:');

 

Thats it, hope somebody will like it

Share this post


Link to post
Share on other sites

Tried this but no luck, i still do not get any emails via the contact us form

also not on a secondary email address, and also no email send when i send them via the admin section to customers.

Why is this such a big problem in OsCommerce?

 

 

 

B. What to do if you don't receive mails send via the contact us form

 

In the most of the cases, there is the host involved, who doesn't permit mails to be send from your site having as a "sender" somebody'w else mail address. Thats the way it is defined in osc

 

What to do?

 

1) in file catalog/contact_us.php

 

Find the code

if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

 

Replace it with

// BOF multimixer//
//define variable $email_body//
$email_body = $enquiry . "\r\n" . $name . "\r\n" . $email_address;
// if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them acourdingly//
//define variable $from_email. Set to Store owner email address as defined in Admin panel//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

 

The mail of the contact us form is send by the store owners mail address and not from the customers. You receive the customers mail in the mail body. This should solve the hosting mail problems (works for yahoo for sure)

Share this post


Link to post
Share on other sites
Tried this but no luck, i still do not get any emails via the contact us form

also not on a secondary email address, and also no email send when i send them via the admin section to customers.

 

In the most of the cases there is the host involved and not osc. Many hosts do not permit emails to be send via the site they host, using a mail account they do not host

 

You can check following:

 

1) Put a email address in the "store" AND "from" field (in the admin panel) that uses the same domain as your osc do, like info@mydomain.com

2) Turn HTML formatting off

3) Try around with the remaining email settings in your admin panel

 

First you need to succeed to send a mail to a customer via the admin, before you start to make any changes to the code

Share this post


Link to post
Share on other sites

Hello George

 

EXCELLENT COMPILATION on E-mail features/changes. Thank you very much for that - exactly what I was looking for.

 

This, also, brings back the hopes in me that I might get an answer to my posted Q with regards to setting up extra contact forms.

 

I have "EP" (extra pages) installed and everything works great, except, any form that I create within its FCK-editor will not be sent to my "store" email address. (initially I thought that EP would share the same files as the core OSC for sending mail via the normal "contact us" form, but I was proven wrong with my assumption).

 

Hence, I wonder if you have an answer to what files need to be (and how) "altered/created and added", so any additional form that was created with EP's FCK-editor can be sent, too.

 

I try to set up a special "Product Request" form. A form clients can use to suggest any products to be added to my store which currently are not offered. This form should also allow the client to upload and attach an image of the requested product.

 

HMMM, I ask a lot... :blush:

 

Have a great day

 

Norbert

 

 

 

In the most of the cases there is the host involved and not osc. Many hosts do not permit emails to be send via the site they host, using a mail account they do not host

 

You can check following:

 

1) Put a email address in the "store" AND "from" field (in the admin panel) that uses the same domain as your osc do, like info@mydomain.com

2) Turn HTML formatting off

3) Try around with the remaining email settings in your admin panel

 

First you need to succeed to send a mail to a customer via the admin, before you start to make any changes to the code

Share this post


Link to post
Share on other sites

Hi George,

 

I tried adding the phone number to contact_us as you described above but I am having problems.

 

The error I got was:

Parse error: syntax error, unexpected $end in /home/mydomain/public_html/contact_us.php on line 233

 

I have re-Captcha installed and perhaps I am not doing the first part correctly. Below is the relevant section of my contact_form:

 

  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']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

// start modification for reCaptcha
// the response from reCAPTCHA
$resp = null;

// was there a reCAPTCHA response?
$resp = recaptcha_check_answer (RECAPTCHA_PRIVATE_KEY,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (tep_validate_email($email_address) & ($resp->is_valid)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

  tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
} else {
  if (!tep_validate_email($email_address)) {
	$error = true;
	$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  }
  if (!$resp->is_valid) {
	$error = true;
	$messageStack->add('contact', ENTRY_SECURITY_CHECK_ERROR . " (reCAPTCHA output: " . $resp->error . ")");
  }
}
 }
// end modification for reCaptcha

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

 

And here is what I did:-

 

  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']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$phone = tep_db_prepare_input($HTTP_POST_VARS['phone']); // add phone 21.6.09
// BOF multimixer//
//define variable $email_body.  if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them accordingly//
$email_body = EMAIL_TEXT_CUSTOMER_NAME . ' ' . $name . "\r\n" . EMAIL_TEXT_CUSTOMER_EMAIL . ' ' .  $email_address . "\r\n" . EMAIL_TEXT_CUSTOMER_PHONE . ' ' . $phone . "\r\n" . EMAIL_TEXT_CUSTOMER_MESSAGE . ' ' . $enquiry;
//define variable $from_email. Set to Store owner email address as defined in Admin panel. If you want mails to be sent from customers mail address, set it to email_address//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

// start modification for reCaptcha
// the response from reCAPTCHA
$resp = null;

// was there a reCAPTCHA response?
$resp = recaptcha_check_answer (RECAPTCHA_PRIVATE_KEY,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (tep_validate_email($email_address) & ($resp->is_valid)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);

  tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
} else {
  if (!tep_validate_email($email_address)) {
	$error = true;
	$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  }
  if (!$resp->is_valid) {
	$error = true;
	$messageStack->add('contact', ENTRY_SECURITY_CHECK_ERROR . " (reCAPTCHA output: " . $resp->error . ")");
  }
}
 }
// end modification for reCaptcha

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

 

Where is the error or what am I doing wrong? :(

 

Thanks.

Share this post


Link to post
Share on other sites

Well, to tell you exactly whats going on, I need to know whats written in line 223, like the error message says. It's like you have a very large contact_us.php

 

What I can see is tha you have 2 tep mail functions. The one is this one

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

 

and the other one is in the captcha modification

if (tep_validate_email($email_address) & ($resp->is_valid)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);

 

So, one thing is, you keep just the second mail function and try again. If there is still the error, post again and please post aso the error message and the error lines

Share this post


Link to post
Share on other sites

Thanks for the reply George.

 

Line 223 was the last line after I added the mod in the contact us php. That line was essentially blank!! But let me try again and I'll post the result here.

 

Regards.

Share this post


Link to post
Share on other sites

An unexpected end is the kind of error that you get when you have an open {, (, [, or whatever without close. It will always be on the last line of the file, because it is saying that it got to the end of the file without finding the closing }. It's a parser error, saying that the file was structurally invalid.

 

If you look at the code that you posted, you have one more { than }. It was introduced by the if that you added.


Always back up before making changes.

Share this post


Link to post
Share on other sites
An unexpected end is the kind of error that you get when you have an open {, (, [, or whatever without close. It will always be on the last line of the file, because it is saying that it got to the end of the file without finding the closing }. It's a parser error, saying that the file was structurally invalid.

 

If you look at the code that you posted, you have one more { than }. It was introduced by the if that you added.

Great to know, thanks.

 

I suppose that deleting the one of the 2 tep mail functions will fix the problem, because there is the additional "{" placed

Share this post


Link to post
Share on other sites

Hello,

 

I get the following error when someone tries to use the contact us form:

 

noLanguage string failed to load: recipients_failedwebmaster@mysite.com

 

I have changed the code as stated here but it still doesn't work. I have verified that using the admin email form webmaster@mysite.com works. But i am not getting the order confirmation emails nor can anyone use the contact us page.

 

Any ideas??

 

Many thanks in advance

Share this post


Link to post
Share on other sites

Hi George and Matt,

 

Thank you both for your replies. Problem solved and yes it was that extra tep line before the reCaptcha mod. I removed it and all okay.

 

And George, I also added the

 

define('ENTRY_PHONE', 'Your Contact Phone:');  //or whatever you want to show on the form

 

includes/languages/english/contact_us.php otherwise the form displayed "ENTRY_PHONE".

 

Cheers.

Share this post


Link to post
Share on other sites

Hi

 

I was wondering how I could remove the email from the orders.php in the admin folder as my merchant sends the email of the order when it comes back into my store....so at the moment I get 2 emails sent to the customer.

 

The reason I want to keep the one I want is that it has a lot more info included into the email that is sent to the customer.

 

Thanks

 

Dicko

Share this post


Link to post
Share on other sites
Hi

 

I was wondering how I could remove the email from the orders.php in the admin folder as my merchant sends the email of the order when it comes back into my store....so at the moment I get 2 emails sent to the customer.

 

The reason I want to keep the one I want is that it has a lot more info included into the email that is sent to the customer.

 

Thanks

 

Dicko

 

If you want to disable the email send to a customer when he makes an order (order confirmation email) then the admin/orders.php is the WRONG place to do it.

 

The mail is getting generated in checkout_process.php

 

Find the line

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

And comment t out with //

Share this post


Link to post
Share on other sites
In the most of the cases, there is the host involved, who doesn't permit mails to be send from your site having as a "sender" somebody'w else mail address. Thats the way it is defined in osc

 

 

George...

 

I am having email issues and your post is timely and helpful. Would it do any good to contact my host and if so, what exactly should I tell them so they know what to check on?

 

Thanks


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites
B. What to do if you don't receive mails send via the contact us form

 

Hello, I am having the Contact Us problems and inserted the code in post number 2. Still doesn't work. Before doing that I contacted my host and they looked into the matter and here's there response to me:

 

We checked e-mail functionality using a mail test script at. We choose both send mail and SMTP options and we were able to send the e-mail to your mailbox using both from the test script. It looks like there in something in the osCommerce application blocking the e-mails from receiving in the mailbox. Unfortunately, we do not give support for third party application. Please contact your Web master or application vendor to resolve the issue from your end.

 

My settings are:

 

E-Mail Transport Method sendmail

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

 

Thanks in advance for any ideas on this.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites
Hello, I am having the Contact Us problems and inserted the code in post number 2. Still doesn't work. Before doing that I contacted my host and they looked into the matter and here's there response to me:

 

 

 

My settings are:

 

E-Mail Transport Method sendmail

E-Mail Linefeeds LF

Use MIME HTML When Sending Emails false

Verify E-Mail Addresses Through DNS false

Send E-Mails true

 

Thanks in advance for any ideas on this.

 

have you tried altering the contact_us.php files as suggested?

that in combination to my Host allowing scripts for email through my site did the trick for me..

Share this post


Link to post
Share on other sites
have you tried altering the contact_us.php files as suggested?

that in combination to my Host allowing scripts for email through my site did the trick for me..

 

Hello and yes I did alter the contact_us.php file. I put in a ticket to my host yesterday and they worked on it quite a bit, even trying out a test_email.php they wrote to see if it would go out. That worked but the Contact Us still didn't. What did your host do from their side. Perhaps there's something there that I could suggest to them.

 

Thanks

 

SK


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Hi all,

 

im very new with osCommerce and thought I have handled any kind of problems but i have a problem with the emails,

i haven't any idea of sending mails via php. I want a "freetext" in my confirmation mails but i have no idea how I can add a

text or where to add a txt.

 

I have already searched and read this topic.

I just fount in the email.php this part:

 

LINE

143 /**

144 * Adds plain text. Use this function

145 * when NOT sending html email

146 */

147

148 function add_text($text = '') {

149 $this->text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);

150 }

 

But I dont know what it means I guess I have to write this in the checkout_process.php....

 

 

Can anybody help a newbie?

Share this post


Link to post
Share on other sites
I want a "freetext" in my confirmation mails but i have no idea how I can add a

text or where to add a txt.

 

In post Number 3 you can read how to add text to the order confirmation email at the top and bottom. You can pick what you want and insert it to the files mentioned there. If you take the "complete" suggestion, you will have also the customers mail and phone in this email, and I think thats not bad to know.

Share this post


Link to post
Share on other sites
have you tried altering the contact_us.php files as suggested?

that in combination to my Host allowing scripts for email through my site did the trick for me..

 

Still working with the Contact Us page not working here. The host did some checking, ran some tests and advised the problem is probably somewhere in the php. They are probably correct. I installed a test oscommerce store yesterday and from that test store, the Contact Us page does work. So I am going to have to look through things to see what might have been changed by me in my store, via add ons, etc along the way. Thanks...


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

×