Answers.Body: <p>I ended up hardcoding it so it uses $contact['email'] instead of $params['to_email']</p>
  
  <p>I am leaving it open for some time, if anybody has a better idea (or if I missed something obvious)</p>
  
  <p>UPDATE:</p>
  
  <p>The developers of the extension included this feature. Using version 2.0 the PDF will be emailed to the associated contact if the to email field is left empty. So no need for hacks anymore. Big thanks to <a href="https://civicrm.stackexchange.com/users/134/erikh-civicoop">ErikH - CiviCooP</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-03T19:42:31.330Z
Answers.LastActivityDate: 2018-10-24T14:48:18.867Z
Answers.LastEditDate: 2018-10-24T14:48:18.867Z
Answers.UserDisplayName: Marko
Body: <p>I am having trouble using CiviRules to send PDFs automatically using <a href="https://github.com/CiviCooP/org.civicoop.pdfapi/" rel="noreferrer">
  PDF API for CiviCR</a>. Namely, when I create condition and I need to add action Send PDF there is <em>to email</em> parameter. I want this to be created dynamically like send Email action picks up email from contact automatically.  </p>
  
  <p>When I leave it blank the email doesn't go through.</p>
  
  <blockquote>
    <p>[info] Civirules api action exception: Mandatory key(s) missing from
    params array: to_email. API call: Pdf.create with params: to_email="",
    template_id="74", contact_id="752"</p>
  </blockquote>
  
  <p>I can't insert a token into that field. So, am I missing something obvious or is this functionality intended for a totally different purpose?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-26T21:54:55.617Z
Comments.Text: Since this question is about an extension, you may want to communicate with the extension authors by creating an issue at https://github.com/CiviCooP/org.civicoop.pdfapi/issues
Comments.UserDisplayName: Noah Miller
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-27T07:44:40.560Z
Comments.Text: I hoped to do some coding and make a PR myself, but I never seem to have the time to do that. I should create an issue either way. Thanks for the suggestion, Noah!
Comments.UserDisplayName: Marko
Tags: <civirules><pdf>
Title: Send PDF email through CiviRules
ThreadText: # Send PDF email through CiviRules
  
  (Asked by: username_0 on 2018-09-03)
  
  I am having trouble using CiviRules to send PDFs automatically using [PDF API for CiviCR](https://github.com/CiviCooP/org.civicoop.pdfapi/). Namely, when I create condition and I need to add action Send PDF there is *to email* parameter. I want this to be created dynamically like send Email action picks up email from contact automatically.
  
  When I leave it blank the email doesn't go through.
  
  > [info] Civirules api action exception: Mandatory key(s) missing from
  > params array: to\_email. API call: Pdf.create with params: to\_email="",
  > template\_id="74", contact\_id="752"
  
  I can't insert a token into that field. So, am I missing something obvious or is this functionality intended for a totally different purpose?
  
  **Tags:** civirules, pdf
  
  > **Comments:**
  > **username_1**: Since this question is about an extension, you may want to communicate with the extension authors by creating an issue at https://github.com/CiviCooP/org.civicoop.pdfapi/issues  
  > **username_0**: I hoped to do some coding and make a PR myself, but I never seem to have the time to do that. I should create an issue either way. Thanks for the suggestion, username_1!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-09-03. Score: 3 | Accepted answer
  
  I ended up hardcoding it so it uses $contact['email'] instead of $params['to\_email']
  
  I am leaving it open for some time, if anybody has a better idea (or if I missed something obvious)
  
  UPDATE:
  
  The developers of the extension included this feature. Using version 2.0 the PDF will be emailed to the associated contact if the to email field is left empty. So no need for hacks anymore. Big thanks to [ErikH - CiviCooP](https://civicrm.stackexchange.com/users/134/erikh-civicoop)
  
  
  ---
  
  