Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add reply-to address to contact form?


MyR

Recommended Posts

Hello,

I am using osCommerce 2.2 RC2.

Problem: my web host only allows outgoing mail from my domain.

 

I made the following change in contact_us.php to allow the form to function:

...
   $email = "customerservice@mydomain.com";
   $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);
...

 

Of course when I receive the email, the customer's email address is not shown since I replaced it with mine.

How can I add the customer's email address to the email header as a reply-to address?

 

Thanks in advance!

Link to comment
Share on other sites

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Link to comment
Share on other sites

Ah I like that idea!

 

me too :)

 

So, you need to do following, all in file contact_us.php ofcourse

 

1) make a new definition, ie "$subject" just before the tep_mal function like this

	$subject = EMAIL_SUBJECT . ' ' . $email_address;

If you want you can have your mail without any other subject, just with the customers email

 

2) In the tep_mail function, you replace EMAIL_SUBJECT with the just defined $subject so that it looks like this

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

 

If you did already the changes like described in email issues post #2 , then your tep_mail function will look like this

      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $subject, $email_body, $name, $from_email);

 

enjoy :)

Link to comment
Share on other sites

Thank you very much for your help! This is a sufficient solution.

 

I would still like to add the customer's reply-to email address to the email headers if possible!

 

Thank you

Link to comment
Share on other sites

Thank you very much for your help! This is a sufficient solution.

 

I would still like to add the customer's reply-to email address to the email headers if possible!

 

Thank you

BACKUP THE FILE.

 

Then replace:

 

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

With:

 

    if (tep_validate_email($email_address)) {
     $headers = 'From: ' . STORE_OWNER_EMAIL_ADDRESS . "\r\n" . 'Reply-To: ' . $email_address . "\r\n";
     mail(STORE_OWNER_EMAIL_ADDRESS , EMAIL_SUBJECT , $enquiry , $headers, '');

It seemed to work for me.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I ended up using this:

 

        if (tep_validate_email($email_address)) {
         $headers = 'From: ' . $name . ' <' . STORE_OWNER_EMAIL_ADDRESS . ">\r\n" . 'Reply-To: ' . $email_address . "\r\n";
         mail(STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $headers, '');

 

Thanks again!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...