Prestashop order-confirmation email attachement (terms and conditions) - email

I am using Prestashop 1.5.4.1 and i need to add new file attachment (.docx document), which is stored on my server, to an order confirmation email. What should i do?
Thanks for Your time
sincerely
Johan

Mail::Send(
5,
'new_order',
'New Order',
array('{provider}' => 'Provider', '{title}' => 'My ePortal'),
'provider#myportal.com',
array('content' => $content, 'name' => $file, 'mime' => 'application/xml'),<------ attachment
null,
null
null,
_PS_MAIL_DIR_,
false,
(int)$order_id
);

Related

Send Report in Email in oracle apex

I looking to send the report or the Table as an attachment in the email, in oracle apex I have tried it show this error
ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified. for Execute PL/SQL Code.
here is the code
DECLARE
l_id number;
l_document BLOB;
BEGIN
l_document := apex_util.get_print_document (
p_application_id => 127,
p_report_query_name => 'CatpbReport',
p_report_layout_name => 'CatpbReport',
p_report_layout_type => 'XSL-FO',
p_document_format => 'pdf' );
l_id := APEX_MAIL.SEND(
p_to => 'xxxxxxxxxxx',
p_from => 'xxxxxxxxxxxx',
p_subj => 'sending PDF by using print API',
p_body => 'Please review the attachment.',
p_body_html => 'Please review the attachment');
APEX_MAIL.ADD_ATTACHMENT (
p_mail_id => l_id,
p_attachment => l_document,
p_filename => 'mydocument.pdf',
p_mime_type => 'application/pdf'
);
END;
i don't know why it's not working for me when I tried in the SQL command it sends the email, when I attach in the dynamic action it shows this as an error.
don't you need printing server to use it?
not an answer to your question but as an alternative:
you can create html, doc, csv by hand, convert it to blob and add it as an attachment to your email.
create lob,
dbms_lob.createtemporary(lob_loc => l_body_blob, cache => true, dur =>dbms_lob.call);
then convert your clob to blob
dbms_lob.converttoblob (
dest_lob => l_body_blob,
src_clob => l_body_clob,
amount => dbms_lob.lobmaxsize,
dest_offset => l_dest_offset,
src_offset => l_source_offset,
blob_csid => dbms_lob.default_csid,
lang_context=> l_lang_context,
warning => l_warning);
then add it to your mail & send
l_mail_id :=
apex_mail.send (
p_to => 'foo#bar.nl',
p_from => 'goo#bar.nl',
p_body => l_body,
p_body_html => l_body,
p_subj => l_subject);
apex_mail.add_attachment(l_mail_id, l_body_blob, 'test.doc', 'application/msword');
optionally:
apex_mail.push_queue;
this way you should get an email with a DOC attachment.

Dont know how to set headers

Could someone help me to set headers to this function. I bought Prestashop module to ask question on product page. But email are sent back to admin email. I know i need to set headers to respond to email given by user.
product = new Product(Tools::getValue('ip_product_id'), true, $id_language, $id_shop);
$sql = 'SELECT email FROM `' . _DB_PREFIX_ . 'contact` WHERE id_contact = ' . (int) (Configuration::get('IP_ASK_ABOUT_PRODUCT_MAIL'));
$mail = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if (Mail::Send((int)$id_language,
'ask',
Mail::l('Pytanie o produkt', (int)$id_language),
array(
'{message}' => Tools::getValue('message'),
'{mail}' => Tools::getValue('ip_ask_about_product_email'),
'{name}' => Tools::getValue('ip_ask_about_product_name'),
'{phone}' => Tools::getValue('ip_ask_about_product_phone'),
'{id_product}' => $product->id,
'{product_name}' => $product->name),
$mail[0]["email"],
null,
null,
null,
null,
null,
dirname(__FILE__) . '/mails/'
))
{
The option you are looking for is ReplyTo. This is the last parameter of function Mail::Send. Your code must look like this:
Mail::Send((int)$id_language,
'ask',
Mail::l('Pytanie o produkt', (int)$id_language),
array(
'{message}' => Tools::getValue('message'),
'{mail}' => Tools::getValue('ip_ask_about_product_email'),
'{name}' => Tools::getValue('ip_ask_about_product_name'),
'{phone}' => Tools::getValue('ip_ask_about_product_phone'),
'{id_product}' => $product->id,
'{product_name}' => $product->name),
$mail[0]["email"],
null,
null,
null,
null,
null,
dirname(__FILE__) . '/mails/',
false,
null,
null,
$mail[0]["email"] /*or the email you want to reply to*/
)
Good luck

send data to email view cakephp

I want to send email with cakephp.
But I want send in the email with lot of data like
'Envoie' => array(
(int) 0 => array(
'id' => '59',
'compte_id' => '1',
'annonce_id' => '19',
'site_id' => '8',
'valider' => '0',
'lien' => null,
'created' => '2013-09-19 15:56:28'
),
in my code i have this
$Email = new CakeEmail();
$Email->template('default', 'a');
$envoie = $this->Envoie->find('all',array('conditions' => array(
'Envoie.annonce_id' =>$annonce['Annonce']['id'])));
$Email->viewVars(array("envoie"=>$envoie));
$Email->emailFormat('html');
$Email->to('email#hotmail.com');//$annonce['User']['username']
$Email->from('no-repley#domaine.com');
$Email->subject('subject');
$Email->send();
How i can send my table to my view ?
You have $envoie array in your view ie app/View/Emails/html/default.ctp.
For example, you can get value of id using $envoie['id'] and so on...
In your email template
app/View/Emails/html/default.ctp
You already have access to $envoie, just extract the variable's values to your needs.

Overwrite Zend Validation Message

How can I overwrite Zend validation messages in my code below.
$validatee = array(
'email' => $email,
);
$validator = array(
'email' => array(
'EmailAddress',
'messages' => array('emailAddressInvalidFormat',"Invalid Email Address")
)
);
$emailValidator = new Zend_Filter_Input(null, $validator,$validatee);
I tried doing that but the message doesn't change and always output
"no valid email address in the basic format local-part#hostname"
please help!
Change your $validator to ::
can you try adding
$validator = new Zend_Validate_EmailAddress();
$validator->setMessage(
'A valid email is required',
Zend_Validate_EmailAddress::INVALID
);
and then use in Zend_filter_input?

CakePHP SMTP EMail Not Working on Server

I am able to send SMTP Emails from my local server machine in CakePHP while I am not able to do the same on my GoDaddy live server, in CakePHP.
Any ideas for the same?
Thanks
Answer is below as per my experience with GoDaddy:
Below code is working for me over GoDaddy server using CakePHP SMTP Email:
Email.php file inside config folder - CakePHP 2.4 MVC version:
// for Live Server GoDaddy.com domain
public $smtp = array(
'transport' => 'Smtp',
'host' => 'ssl://smtpout.asia.secureserver.net', // important
'port' => 465, // important
#'timeout' => 30,
'username' => 'no-reply#godaddy-domain.com',
'password' => 'password',
#'tls' => false,
#'log' => false,
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
And here is the controller file code below:
// Controller Code to Send Actual Email
// email configuration
$Email = new CakeEmail('smtp');
$Email->from(array('no-reply#godaddy-domain.com' => 'App Name'))
->sender('no-reply#godaddy-domain.com', 'App Name')
->to(array($email))
->bcc(array('xyz#xyz.com'))
->subject('Test Email from GoDaddy')
->emailFormat('both')
->send($hash.'<br><strong>My</strong> message 45 قبل الميلاد، مما يجعله أكثر من');
Hope it helps !
Thanks
Update your code to check for an error message:
if(!$this->Email->send()) {
CakeLog::write('debug', $this->Email->smtpError);
}
Then check the /app/tmp/logs/debug file on the server.