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
Related
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.
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
);
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.
I am trying to get all contacts for a particular account (i know the account id) from SugarCRM using the v2 REST API.
I am sending a GET request with the following parameters:
input_type => 'JSON'
response_type => 'JSON'
method => 'get_entry_list'
rest_data => '{session:"some-valid-session-id", module_name:"Contacts", query:"contacts.account_id=some-valid-id"}'
I expect to get all contacts that are related to this accoutn, but instead I get an error "... MySQL error 1054: Unknown column 'contacts.account_id' in 'where clause'"
However, when I try to get all contacts without providing any query (query='') I get all the contacts with all their properties and I can see that there is an account_id property.
Can anyone help?
Try query:"accounts.id=some-valid-id".
It has worked for me in the past with the SOAP API.
Here's my method. It uses this wrapper class: http://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class/
/**
* returns an array of contacts that are related to the accountId passed as a param.
* The array returned will be an array of associative arrays.
* #param $accountId
* #param array $contactSelectFields optional sets the different items to return, default includes id, email1, name, title, phone_work, and description
* #return array
*
*/
public function getAllContactsAtOrganization( $accountId, $contactSelectFields=array("id", "email1", "name", "title", "phone_work", "description")) {
$sugar = new Sugar_REST( SUGAR_REST_URL, SUGAR_USER_NAME, SUGAR_PASSWORD);
$fields = array( "Accounts" => array("id", "name"),
"Contacts" => $contactSelectFields);
$options = array(
'where' => "accounts.id='$accountId'"
);
$apiResult = $sugar->get_with_related("Accounts", $fields, $options );
$contacts = array();
foreach( $apiResult['relationship_list'][0]['link_list'][0]['records'] as $almostContact) {
$curr = array();
foreach($contactSelectFields as $key) {
$curr[$key] = $almostContact['link_value'][$key]['value'];
}
$contacts[] = $curr;
}
//print_r($contacts);
return $contacts;
}
Sample Return
Array
(
[0] => Array
(
[id] => 47e1376c-3029-fc42-5ae2-51aeead1041b
[email1] => johndoe#gmail.com
[name] => Blake Robertson
[title] => CTO
[phone_work] => 8881112222
[description] => Opinionated developer that hates SugarCRM's REST API with a passion!
)
[1] => Array
(
[id] => 4c8e3fcf-8e69-ed7d-e239-51a8efa4f530
[email1] => csmith#mailinator.com
[name] => Carolyn Smith
[title] => Director of Something
[phone_work] => 832-211-2222
[description] => She's a smooth operator...
)
)
For Reference Purposes
Here's the "rest-data" (nicely formatted)
Used print_r of the php array
Array
(
[session] => 9j7fm4268l0aqm25kvf9v567t3
[module_name] => Accounts
[query] => accounts.id='e583715b-7168-5d61-5fb1-513510b39705'
[order_by] =>
[offset] => 0
[select_fields] => Array
(
[0] => id
[1] => name
)
[link_name_to_fields_array] => Array
(
[0] => Array
(
[name] => contacts
[value] => Array
(
[0] => id
[1] => email1
[2] => name
[3] => title
[4] => phone_work
[5] => description
)
)
)
[max_results] => 20
[deleted] => FALSE
)
Post Body
method=get_entry_list&input_type=JSON&response_type=JSON&rest_data={"session":"iov5a257lk5acsg9l3ll6kuej3","module_name":"Accounts","query":"accounts.id='e583715b-7168-5d61-5fb1-513510b39705'","order_by":null,"offset":0,"select_fields":["id","name"],"link_name_to_fields_array":[{"name":"contacts","value":["id","email1","name","title","phone_work","description"]}],"max_results":20,"deleted":"FALSE"}method=logout&input_type=JSON&response_type=JSON&rest_data={"session":"iov5a257lk5acsg9l3ll6kuej3"}
I'm not familiar with SugarCRM yet, but did you try with just account_id=some-valid-id ? because I also did a REST request to add a contact to sugarcrm and I didn't mention the table's name, just the fields. I didn't try this but it seems logical to me since you already mentionned the module's name, so I guess sugar kind of knows what table(s?) to look for when processing your query.
How to use openid extensions with google? I have something like this, I allready applied some patches which are basically the same as here: http://ak33m.com/?p=71
It does work without extensions?
$extensions = new Zend_OpenId_Extension_Sreg(array(
'nickname' => false,
'email' => true,
'fullname' => false
),
null,
'1.1'
);
if ($form->isValid($post)) {
$open_id_adapter = new App_Auth_Adapter_OpenId($post['openid_identifier'],null, null, null, $extensions);
$result = $auth->authenticate($open_id_adapter);
} else {
$open_id_adapter = new App_Auth_Adapter_OpenId(null, null, null, null, $extensions);
$result = $auth->authenticate($open_id_adapter);
}
if ($result->isValid()) {
$this->_helper->flashMessenger->addMessage(array(
'message' => 'U bent ingelogd',
'status' => 'success'
));
}
Maybe having a look at an example ZF 1.11 application that uses OpenID (including google) for authentication will clarify how to make it work (source code is also available).