WebSite X5Help Center

 
Kal M.
Kal M.
User

Email form contents not being received  en

Author: Kal M.
Visited 4497, Followers 1, Shared 0  

Email form is not sending any data to me and I have been told the php function is disabled on the shared server and to use PEAR http://pear.php.net/ so how would i put this code in my email contact form?

I have changed the script to low quality script and upload this and still no content

Posted on the
7 ANSWERS
Incomedia
Claudio D.
Incomedia

Hello Kal,

WebSite X5 uses the PHP mail() function to send the emails from the website.

You need to use a custom code to send emails or modify manually the email form script to work with PEAR to send the emails.

I would like to suggest that you open an "Idea" Post where you describe to us the feature you would like to see implemented in the future releases of WebSite X5.

Many thanks!

Read more
Posted on the from Claudio D.
Kal M.
Kal M.
User
Author

how do i manually edit the email form script? what is it called?

Read more
Posted on the from Kal M.
Incomedia
Claudio D.
Incomedia

Hello Kal,

In the installation folder of WebSite X5 Evolution 9 in program files you find the file imemail.inc.php in the RES folder and this file needs to be modified.

Many thanks!

Read more
Posted on the from Claudio D.
Kal M.
Kal M.
User
Author

If i modify this php file, will this email address change for all the different domains i have for each website?

for e.g.www.racartechnologies.com this php modification change will change email form and www.bharu the email change will be same as racartechnolgies.com?

Read more
Posted on the from Kal M.
Incomedia
Claudio D.
Incomedia

Hello Kal,

Yes if you modify the file in the installation folder this will change it on all projects. If you need it only for one hosting then modify the imemail.inc.php file on the exported project online. Remember to change it everytime you make a new upload because this file will be overwritten and you need to add again the modified file to make it work.

Many thanks!

Read more
Posted on the from Claudio D.
Kal M.
Kal M.
User
Author

Hi

I have modified the file imemail.inc.php

is this correct?, not sure which file name to put in 'include' path.

when I upload it, can check www.racartechnologies.com/location, submit the form I don't see the thank you page and I am still not receiving the emails.

____________________________________________________________________________

<?php


include('contact-feedback-confirmation-page.html');

$recipients = '***'; //CHANGE

$headers['From']    = '***'; //CHANGE
$headers['To']      = '***'; //CHANGE
$headers['Subject'] = 'Enquiry from Website';

$body = 'Enquiry from website';

// Define SMTP Parameters

$params['host'] = 'mail.authsmtp.com';
$params['port'] = '587';
$params['auth'] = 'PLAIN';
$params['username'] = '***'; //CHANGE
$params['password'] = 'XXXXXX'; //CHANGE

/* The following option enables SMTP debugging and will print the SMTP
conversation to the page, it will only help with authentication issues,
if PEAR::Mail is not installed you won't get this far. */

$params['debug'] = 'true';

// Create the mail object using the Mail::factory method

$mail_object =& Mail::factory('smtp', $params);

// Print the parameters you are using to the page

foreach ($params as $p){
        echo "$p<br />";
}

// Send the message

$mail_object->send($recipients, $headers, $body);

   //Incomedia WebSite X5 EMail Class. All rights reserved.

 class imEMail {
  var $from;
  var $to;
  var $subject;
  var $charset;
  var $text;
  var $html;

  var $attachments;

  function imEMail($from,$to,$subject,$charset) {
   $this->from = $from;
   $this->to = $to;
   $this->charset = $charset;
   $this->subject = "=?" . strtoupper($this->charset) . "?B?". base64_encode($subject) . "?=";
  }

  function setFrom($from) {
   $this->from = $from;
  }

  function setTo($to) {
   $this->to = $to;
  }

  function setSubject($subject) {
   $this->subject = "=?" . strtoupper($this->charset) . "?B?". base64_encode($subject) . "?=";
  }

  function setCharset($charset) {
   $this->charset = $charset;
  }

  function setText($text) {
   $this->text = $text;
  }

  function setHTML($html) {
   $this->html = $html;
  }

  function attachFile($name,$content,$mime_type) {
   $attachment['name'] = "=?" . strtoupper($this->charset) . "?B?". base64_encode($name) . "?=";
   $attachment['content'] = base64_encode($content);
   $attachment['mime_type'] = $mime_type;
   $this->attachments[] = $attachment;
  }

  function send() {
   $headers = "";
   $msg = "";

   if($this->from == "" || $this->to == "" || ($this->text == "" && $this->html == ""))
    return false;

   $boundary_file = md5(time() . "_attachment");
   $boundary_alt = md5(time() . "_alternative");

   $headers .= "From: " . $this->from . "\n";
   $headers .= "Message-ID: <" . time() . rand(0,9) . rand(0,9) . "@websitex5.users>\n";
   $headers .= "X-Mailer: WebSiteX5 Mailer\n";
   $headers .= "MIME-Version: 1.0\n";

   if(is_array($this->attachments)) {
    $headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary_file . "\"\n\n";
    $headers .= "--" . $boundary_file . "\n";
   }

   if($this->html == "") {
    $headers .= "Content-Type: text/plain; charset=" . strtoupper($this->charset) . "\n";
    if (strtolower($this->charset) != "utf-8")
     $headers .= "Content-Transfer-Encoding: 7bit\n";
    else
      $headers .= "Content-Transfer-Encoding: 8bit\n";
    $msg .= $this->text . "\n\n";
   }
   else if($this->text == "") {
    $headers .= "Content-Type: text/html; charset=" . strtoupper($this->charset) . "\n";
      if (strtolower($this->charset) != "utf-8")
     $headers .= "Content-Transfer-Encoding: 7bit\n";
        else
      $headers .= "Content-Transfer-Encoding: 8bit\n";
    $msg .= $this->html . "\n\n";
   }
   else {
    $headers .= "Content-Type: multipart/alternative; boundary=\"" . $boundary_alt . "\"\n";

    $msg .= "--" .$boundary_alt . "\n";
    $msg .= "Content-Type: text/plain; charset=" . strtoupper($this->charset) . "\n";
    if (strtolower($this->charset) != "utf-8")
       $msg .= "Content-Transfer-Encoding: 7bit\n";
        else
      $msg .= "Content-Transfer-Encoding: 8bit\n";
    $msg .= "\n";
    $msg .= $this->text . "\n\n";

    $msg .= "--" . $boundary_alt . "\n";
     $msg .= "Content-Type: text/html; charset=" . strtoupper($this->charset) . "\n";
     if (strtolower($this->charset) != "utf-8")
     $msg .= "Content-Transfer-Encoding: 7bit\n";
        else
      $msg .= "Content-Transfer-Encoding: 8bit\n";
    $msg .= "\n";
    $msg .= $this->html . "\n\n";

    $msg .= "--" . $boundary_alt . "--\n\n";
   }

   if(is_array($this->attachments)) {
    foreach($this->attachments as $attachment) {
     $msg .= "--" . $boundary_file . "\n";
     $msg .= "Content-Type: " . $attachment["mime_type"] . "; name=\"" . $attachment["name"] . "\"\n";
     $msg .= "Content-Transfer-Encoding: base64\n";
     $msg .= "Content-Disposition: attachment; filename=\"" . $attachment["name"] . "\"\n\n";
     $msg .= chunk_split($attachment["content"]) . "\n\n";
    }

    $msg .= "--" . $boundary_file . "--\n\n";
   }

      if (function_exists('ini_set'))
    @ini_set("sendmail_from", $this->from);

   $r = @mail($this->to, $this->subject, $msg, $headers, "-f" . $this->from);
   if(!$r) {
    $headers = "To: " . $this->to . "\n" . $headers;
    $r = @mail($this->to, $this->subject, $msg, $headers);
   }
   return $r;
  }
 }

// End of file imemail.inc.php

Read more
Posted on the from Kal M.
Incomedia
Claudio D.
Incomedia

Hello Kal,

Unfortunately I cannot help you with the use of custom code since the functions do not depend on WebSite X5.

You need to check if the code is correctly integrated with the email form object of WebSite X5. Alternatively if you got from the hostign provider an example of working email form you can add it in the HTML&Widget object so you will use this custom code as email form.

Many thanks!

Read more
Posted on the from Claudio D.