Gilpat and the other guys...
MY FAULT!
I must have been retarded at the time but I did not include the template file in the original zip.. terribly sorry....
Im in a rush so the location for the setting.tpl file is a full path, but it must go under your store's /admin/template/default/content/
Soory again and let me know if this solves your issues
MY FAULT!
I must have been retarded at the time but I did not include the template file in the original zip.. terribly sorry....
Im in a rush so the location for the setting.tpl file is a full path, but it must go under your store's /admin/template/default/content/
Soory again and let me know if this solves your issues
Attachments
Okey this is really important...
The basic MailSend of OpenCart Wasn't working [ Excpet for internal server mails ( mails @mydomain ) ] but if tried to use someone else mail like @hotmail or somthing he don't recive anything...
My SMTP Server requiers logon, so i think i need to add SMTP Password to your modification . how can i do that ?! becuase i still not reciving mails after appliening your mod
The basic MailSend of OpenCart Wasn't working [ Excpet for internal server mails ( mails @mydomain ) ] but if tried to use someone else mail like @hotmail or somthing he don't recive anything...
My SMTP Server requiers logon, so i think i need to add SMTP Password to your modification . how can i do that ?! becuase i still not reciving mails after appliening your mod
You'll probably find that for some reason or another PHP's mail() function isn't suitable for their setup/operating system.
Alternatives include:
http://pear.php.net/package/Mail
http://sourceforge.net/projects/phpmailer
There is also swiftmailer, which i've only just heard of.
In past projects phpmailer was the most suitable option, I suspect we may incorporate this into OpenCart v0.8.
Alternatives include:
http://pear.php.net/package/Mail
http://sourceforge.net/projects/phpmailer
There is also swiftmailer, which i've only just heard of.
In past projects phpmailer was the most suitable option, I suspect we may incorporate this into OpenCart v0.8.
This will give you most of what you need to do to integrate swift mailer. It uses an smtp server and this example also shows how to convert images in the html email template to embedded images in the html email.
The project I did this for was based on 0.7.7.
create a folder library\external\Swift and upload the swift mailer to that location. The result is shown in the attached image.
modify config.php (admin as well) by adding something similar to the following
modify index.php (in admin as well)
backup library\mail.php and replace it with
finally, download simple_html_dom from http://sourceforge.net/projects/simplehtmldom and place simple_html_dom.php in the library\external folder.
usage example:
The project I did this for was based on 0.7.7.
create a folder library\external\Swift and upload the swift mailer to that location. The result is shown in the attached image.
modify config.php (admin as well) by adding something similar to the following
Code: Select all
define('HOSTING_DIR', 'C:/xampp/htdocs/077');
define('DIR_EXTERNAL', HOSTING_DIR . '/library/external/');
if ( ! defined( 'PATH_SEPARATOR' ) )
{
if ( strpos( $_ENV[ 'OS' ], 'Win' ) !== false )
define( 'PATH_SEPARATOR', ';' );
else
define( 'PATH_SEPARATOR', ':' );
}
modify index.php (in admin as well)
Code: Select all
// External packages
$include_path = ini_get('include_path') ;
$include_path .= PATH_SEPARATOR . DIR_EXTERNAL;
$include_path .= PATH_SEPARATOR . DIR_EXTERNAL . '/Swift/'; // Swift Mailer
ini_set('include_path', $include_path);
Code: Select all
<?php
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
// example of how to modify HTML contents
require_once 'simple_html_dom.php';
class Mail
{
var $to;
var $cc;
var $bcc;
var $from;
var $sender;
var $subject;
var $charset;
var $text;
var $html;
var $attachments = array();
function setTo($to)
{
$this->to = $to;
}
function setCc($cc)
{
$this->cc = $cc;
}
function setBcc($bcc)
{
$this->bcc = $bcc;
}
function setFrom($from)
{
$this->from = $from;
}
function setSender($sender)
{
$this->sender = $sender;
}
function setSubject($subject)
{
$this->subject = $subject;
}
function setCharacterSet($charset)
{
$this->charset = $charset;
}
function setText($text)
{
$this->text = $text;
}
function setHtml($html)
{
$this->html = $html;
}
function setAttachment($attachment)
{
$this->attachments[] = $attachment;
}
//
// Modified send to fail without killing the web site with an exit.
// ToDo: When logging is implemented, log these errors so the store owner can respond appropriately.
//
function send(&$errMessage)
{
if (!$this->to)
{
$errMessage .= 'mail->send: To not set ';
return false;
}
if (!$this->from)
{
$errMessage .= 'mail->send:From not set ';
return false;
}
/* if (!$this->sender)
{
return false;
//exit('Error: Sender not set');
}
*/
if (!$this->subject)
{
//$this->subject = '(no subject)';
$errMessage .= 'mail->send: Subject not set ';
return false;
//exit('Error: Subject not set');
}
if ((!$this->text) && (!$this->html))
{
$errMessage .= 'mail->send: message has no body ';
return false;
//exit('Error: Message not set');
}
$recipients = new Swift_RecipientList();
if (is_array($this->to))
{
foreach($this->to as $to)
{
$recipients->addTo($to);
}
}
else
{
$recipients->addTo($this->to);
}
if ($this->cc)
{
if (is_array($this->cc))
{
foreach($this->cc as $cc)
{
$recipients->addCc($cc);
}
}
else
{
$recipients->addCc($this->cc);
}
}
if ($this->bcc)
{
if (is_array($this->bcc))
{
foreach($this->bcc as $bcc)
{
$recipients->addBcc($bcc);
}
}
else
{
$recipients->addBcc($this->bcc);
}
}
if ($this->charset)
{
$charset = $this->charset;
}
else
{
$charset = 'utf-8';
}
try
{
$smtp = new Swift_Connection_SMTP("your smtp server name", 25);
$swift = new Swift($smtp);
$message = new Swift_Message($this->subject);
if ($this->html)
{
//
// Parse out all the image links and embed them.
//
// Hack: The swiftmailer has a plugin for this but I could not make it work quickly
// and have not the time to investigate. Also we do not check to see if the image
// is already embedded. It just gets embedded again.
//
try
{
$dom = new simple_html_dom();
$dom->load($this->html);
foreach($dom->find('img') as $node)
{
$img = new Swift_Message_Image(new Swift_File($node->src));
$src = $message->attach($img);
$node->src = $src;
}
}
catch(Exception $ex)
{
$errMessage .= "There was a problem converting the images: " . $ex->getMessage() . ' ';
return false;
}
// ToDo: later do the same for all style sheets
// For the moment, style sheet links must be edited from the html and embedded in the template as styles.
$message->attach(new Swift_Message_Part($dom->outertext, "text/html"));
}
if ($this->text)
{
$message->attach(new Swift_Message_Part($this->text));
}
//
// ToDo: Handle attachments when and if required by accolades.
//
$send_count = $swift->send($message, $recipients, $this->from);
//recommended to do this
$swift->disconnect();
return $send_count;
}
catch (Swift_ConnectionException $e)
{
$errMessage .= "There was a problem communicating with SMTP: " . $e->getMessage() . ' ';
return false;
}
catch (Swift_Message_MimeException $e)
{
$errMessage .= "There was an unexpected problem building the email:" . $e->getMessage() . ' ';
return false;
}
}
}
?>
usage example:
Code: Select all
$msg = $this->locator->create('template');
// add data to the email template.
$msg->set('recipient_fullname', $rec_address['firstname'] . ' ' . $rec_address['lastname']);
//
// Confirmation email to recipient with blind copy to store email address
//
$email->setSubject('Confirmation');
$email->setTo($rec_address['email']);
$email->setFrom($config->get('config_email'));
$email->setBcc($config->get('config_email'));
$email->setHtml($msg->fetch('content/email_accepted_recipient.tpl'));
if (!$email->send($errMessage))
{
// handle the error 'Failed to send recipient acceptance confirmation email. '
}
A ready to work solution can be found here:
http://forum.opencart.com/index.php/top ... l#msg13537
I am thinking about adding this into 0.7.9...?
http://forum.opencart.com/index.php/top ... l#msg13537
I am thinking about adding this into 0.7.9...?
I'd say if you are going to add this, you should add some radios on the Admin->configuration->setting->Mail tab
"Send Copy of Account Create Email to Store owner: Yes/No"
"Send Copy of Order Email to Store owner: Yes/No"
I would like the order email forwarded for sure, but not the account create email.
"Send Copy of Account Create Email to Store owner: Yes/No"
"Send Copy of Order Email to Store owner: Yes/No"
I would like the order email forwarded for sure, but not the account create email.
I was just thinking that it could be added, and people could remove it if they didn't want it, for now.
After all, I think most people would want it by default, those that don't could hack it out.
Depends whether we want it to be opt-in or opt-out by default?
After all, I think most people would want it by default, those that don't could hack it out.
Depends whether we want it to be opt-in or opt-out by default?
Who is online
Users browsing this forum: No registered users and 26 guests