Post by tonyforty » Sat Apr 28, 2012 5:49 am

Hi. I have version 1.5.1.3 I supply documents to customers and some times I have to email them a scanned copy, Is it possible to have an add attachment facility to the comment box in order history notify customer just like in a normal email.
Thanks,
tonyforty.

Newbie

Posts

Joined
Fri Apr 13, 2012 3:00 am
Location - Ireland

Post by Avvici » Sat Apr 28, 2012 9:56 pm

Just use what is already available in the mail class by adding this line to your function:

Code: Select all

$mail->addAttachment(HTTP_IMAGE . $this->config->get('config_logo'));
That will just add your store logo as an attachment for example.

However, you may not want to attach something so you won't always want to call this. You'll want to set it up as a conditional, starting with the image/file upload as the attachment.

Hypothetical Code: (taken from your addHistory function)

Code: Select all

$mail = new Mail();
			$mail->protocol = $this->config->get('config_mail_protocol');
			$mail->parameter = $this->config->get('config_mail_parameter');
			$mail->hostname = $this->config->get('config_smtp_host');
			$mail->username = $this->config->get('config_smtp_username');
			$mail->password = $this->config->get('config_smtp_password');
			$mail->port = $this->config->get('config_smtp_port');
			$mail->timeout = $this->config->get('config_smtp_timeout');
			$mail->setTo($order_info['email']);
			$mail->setFrom($this->config->get('config_email'));
 //PERFORM CHECK HERE
  if ($data['attachment']) {
 $mail->addAttachment(HTTP_IMAGE . $this->config->get('config_logo'));
  }
                       //END CHECK
			$mail->setSender($order_info['store_name']);
			$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
			$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
			$mail->send();

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by tonyforty » Thu May 03, 2012 12:16 am

Thank you I will try it.

Newbie

Posts

Joined
Fri Apr 13, 2012 3:00 am
Location - Ireland
Who is online

Users browsing this forum: No registered users and 3 guests