Forums / General Questions / mail function

mail function

Locked

Started by machaneko on 19 Jun 2008, 1:50 PM · Views: 3,491

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
19 Jun 2008, 1:50 PM
#1
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

mail function

i don't know where to put this so i'll post here.

i have a form that needs to be emailed to my boss similar to the way the contact_us page works. however the form is giving me issues and i was wondering if there is a way to configure the page to be emailed the same way as the contact us page emails? the code i have keeps giving errors. i want to see if i can copy the contact us code and format it to send the repair form page.

The Form

conact us page

19 Jun 2008, 2:49 PM
#2
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

I know this is a weird question but i'm hoping its possible.

i have a form that needs to be emailed to my boss similar to the way the contact_us page works. however the form is giving me issues and i was wondering if there is a way to configure the page to be emailed the same way as the contact us page emails? the code i have keeps giving errors. i want to see if i can copy the contact us code and format it to send the repair form page.

The Form

conact us page

EDIT: i reposted this in the email section. sorry for reposting but i'm hoping to get a better answer there and close this thread but idk how.

19 Jun 2008, 3:57 PM
#3
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

help is greatly appreciated. my boss wants this form functional asap to bring in more revenue. :smile:

19 Jun 2008, 4:14 PM
#5
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

Error Image here

ill check out that mod you mentioned and play with it a bit. if anyone can fix this stupid error i get while im playing with the mod it would be great.

19 Jun 2008, 9:23 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: mail function

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Jun 2008, 2:08 PM
#8
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

thank you dr byte, this contribution is helping me alot ^_^

for anyone who can help, i altered the original band_signup for my boss and i'm trying to send it however i only get a page not found 404. lol obviously i'm doing something wrong but i dont know what.

My Form

Would it be because of my new added items that i haven't defined yet?

23 Jun 2008, 2:59 PM
#9
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

ok i figured out how to make it post the email however now im getting the following errors:

Sorry, my system does not understand your email address. Please try again.
Error Please fill in the contact lastname

23 Jun 2008, 3:08 PM
#10
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

my error. i never changed the last name id properly.

however, instead of taking what is typed in the email field, it now tries to take what is in the last name field and use it as the email. any help on how to change that?

23 Jun 2008, 3:23 PM
#11
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

ok i found a better thing to help me out with.

this is my new form using the band_signup thanks to Dr Byte
My Form

i now have a new error:
instead of taking what is typed in the email field, it now tries to take what is in the last name field and use it as the email. any help on how to change that?

old thread

here is what it says: (by the way, the last name entered is the piohk,j)
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\forcemeasurement\includes\functions\functions_email.php on line 387

Email Error: The following From address failed: piohk,j

23 Jun 2008, 3:30 PM
#12
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,723
Plugin Contributions:
0

Re: mail function

Moderator's note: The 2 threads have been combined into 1.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

23 Jun 2008, 3:31 PM
#13
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

thank you!

23 Jun 2008, 6:09 PM
#14
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

if anyone knows how to help please do. my boss wants to use this asap.

24 Jun 2008, 5:50 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: mail function

If it's putting the last name in the email field, then you've done something wrong in your coding whereby either you're passing the wrong parameters to the zen_mail function or you're mixing up values between variables somewhere.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

24 Jun 2008, 12:02 PM
#16
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

i'll recheck my code then. if i paste it here, will anyone help me find my mistake?

24 Jun 2008, 12:42 PM
#17
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

i'm pretty sure the error is on this page. i'm confused since it reads correct to me. i must be missing something.

<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: header_php.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
//
  require(DIR_WS_MODULES . 'require_languages.php');
  $breadcrumb->add(NAVBAR_TITLE);

  $error = false;
  $cemail = '';
  $company = '';
  $address = '';
  $state = '';
  $city = '';
  $zip = '';
  $phone = '';
  $fax = '';
  $po = '';
  $ship = '';
  $contact_firstname = '';
  $contact_lastname = '';
  $idnum = '';
  $manufacturer = '';
  $model = '';
  $serialnum = '';
  $tolerance = '';
  $comments = '';


  if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
    $cemail = zen_db_prepare_input($_POST['cemail']);
    $company = zen_db_prepare_input($_POST['company']);
    $address = zen_db_prepare_input($_POST['address']);
    $state = zen_db_prepare_input($_POST['state']);
    $city = zen_db_prepare_input($_POST['city']);
    $zip = zen_db_prepare_input($_POST['zip']);
    $phone = zen_db_prepare_input($_POST['phone']);
    $fax = zen_db_prepare_input($_POST['fax']);
    $po = zen_db_prepare_input($_POST['po']);
    $ship = zen_db_prepare_input($_POST['ship']);
    $contact_firstname = zen_db_prepare_input($_POST['contact_firstname']);
    $contact_lastname = zen_db_prepare_input($_POST['contact_lastname']);
    $idnum = zen_db_prepare_input($_POST['idnum']);
    $manufacturer = zen_db_prepare_input($_POST['manufacturer']);
    $model = zen_db_prepare_input($_POST['model']);
    $serialnum = zen_db_prepare_input($_POST['serialnum']);
    $tolerance = zen_db_prepare_input($_POST['toelrance']);
    $comments = zen_db_prepare_input(strip_tags($_POST['comments']));

    if (!zen_validate_email($cemail))  {
      $error = true;
      $messageStack->add('repair_form', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
      }
    if (!zen_not_null($cemail))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the email');
      }
    if (!zen_not_null($address))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the address');
      }
    if (!zen_not_null($state))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the state');
      }
    if (!zen_not_null($city))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the city');
      }
    if (!zen_not_null($phone))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the phone');
      }
    if (!zen_not_null($fax))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the fax');
      }
    if (!zen_not_null($contact_firstname))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the Contact First Name');
      }
    if (!zen_not_null($contact_lastname))  {
      $error = true;
      $messageStack->add('repair_form', 'Please fill in the Contact Last Name');
      }
    if (!isset($_POST['certificate']) || ($_POST['certificate'] != '1')) {
      $error = true;
      $messageStack->add_session('repair_form', 'You must choose a certificate level.', 'error');
    }

   if ($error == false) {

// grab some customer info if logged in
      if(isset($_SESSION['customer_id'])) {
        $check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address
        from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
        $customer_email = $check_customer->fields['customers_email_address'];
        $customer_name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->
        fields['customers_lastname'];
      } else {
        $customer_email = 'Not logged in';
        $customer_name = 'Not logged in';
      }

//assemble the email contents:
      $email_text = 'Repair Form Submission: ' . "\n" .
        '------------------------------------------------------' . "\n" .
        'cemail:' . "\t" . $cemail . "\n" .
        'address:' . "\t" . $address . "\n" .
        'state:' . "\t" . $state . "\n" .
        'city:' . "\t" . $city . "\n" .
        'zip:' . "\t" . $zip . "\n" .
        'contact_firstname:' . "\t" . $contact_firstname . "\n" .
        'contact_lastname:' . "\t" . $contact_lastname . "\n" .
        'phone:' . "\t" . $phone . "\n" .
        'fax:' . "\t" . $fax . "\n" .
        'po:' . "\t" . $po . "\n" .
        'ship:' . "\t" . $ship . "\n" .
        'manufacturer:' . "\t" . $manufacturer . "\n" .
        'model:' . "\t" . $model . "\n" .
        'serialnum:' . "\t" . $serialnum . "\n" .
        'idnum:' . "\t" . $idnum . "\n" .
        'calibrate:' . "\t" . $calibrate . "\n" .
        'tolerance:' . "\t" . $tolerance . "\n" .
        'certificate:' . "\t" . $certificate . "\n" .
        'comments:' . "\t" . $comments . "\n\n" .
        '------------------------------------------------------' . "\n" .
        OFFICE_USE . "\t" . "\n" .
        OFFICE_LOGIN_NAME . "\t" . $customer_name . "\n" .
        OFFICE_LOGIN_EMAIL . "\t" . $customer_email . "\n" .
        OFFICE_IP_ADDRESS . "\t" . $_SERVER['REMOTE_ADDR'] . "\n" .
        OFFICE_HOST_ADDRESS . "\t" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n" .
        OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n" .
        '------------------------------------------------------' . "\n\n" .
      $email_text = zen_output_string_protected($email_text);
      $email_html = nl2br("\n" . $email_text);

//send the email
      zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text,
      $contact_firstname, $contact_lastname, $cemail, array('EMAIL_MESSAGE_HTML' => $email_html),
      'repair_form');

      zen_redirect(zen_href_link(FILENAME_repair_form, 'action=success'));
      } //endif $error=false

  } // endif action

// default email and name if customer is logged in
  if(isset($_SESSION['customer_id'])) {
      $check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address
      from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
      if ($cemail == '') $cemail = $check_customer->fields['customers_email_address'];
      if ($contact_firstname == '') $contact_firstname = $check_customer->fields['customers_firstname'];
      if ($contact_lastname == '') $contact_lastname = $check_customer->fields['customers_lastname'];
  }

?>

**
The Form
**

24 Jun 2008, 4:34 PM
#18
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

can anyone help? its really getting frustrating now. :cry:

24 Jun 2008, 5:31 PM
#19
machaneko avatar

machaneko

Zen Follower

Join Date:
Apr 2008
Posts:
174
Plugin Contributions:
0

Re: mail function

no need for anyone to post. i got it on my own

25 Jun 2008, 6:34 AM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: mail function

Glad you got it sorted out. Sometimes it can feel like a needle in a haystack when there's so many fields and parameters to work with :eek:

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.