TYPO3 Powermail access values directly - typo3

in TYPO3 powermail receiver body there is a
{powermail_all}
to print all the input variables into the body of the receivers mail.
is there an possibility to only print some of the input values?
something like
{powermail_firstname}
thanks

Yes, just use {firstname} or something like {markername} in RTE, Mail templates, subject, etc...

As stated in the documentation, this would be possible with {firstname}.

Related

TYPO3 form framework: Sending email as both HTML and Plain Text

The finishers EmailToSender and EmailToReceiver both give the format option 'html' OR 'plaintext'. How can I send emails with both, 'plaintext' AND 'html'?
The background is: AFAIK emails should always contain a defined plaintext part for those of us who are not able or do not wish to receive HTML emails. AFAIK this is required by RFC (don't know which one).
This feature was added to TYPO3v10: Send plaintext and HTML mails in EmailFinisher
As I never work much with the form-extension I don't know exactly if you're right about the mail-format, specifically that html-format never includes a text-only-part. I'd advise to check that the mail-format is really html and not multipart.
If required you can add an own finisher, also as option in the Backend selection.
In this documentation are many things described what is possible:
add own finisher class(es)
exchange data between different finishers
localize (translate) finishers
define default values
use the context of finishers
add the finisher to the UI of the backend
As first step I'd try to program a simple finisher, it can do some simple thing like adding "Hello World" to the mail or replacing the mail-text completely.
In this class I'd try to access data from other finishers and test if these data are programatically available even without activating the other finishers by choice in backend. If that's possible you could retrieve data from the two finishers for text- and html-mail and combine them according to your need.
To add a bit code here, this is how a simple finisher is included:
TYPO3:
CMS:
Form:
prototypes:
standard:
finishersDefinition:
CustomFinisher:
implementationClassName: 'VENDOR\MySitePackage\Domain\Finishers\CustomFinisher'
and this is a simple finisher-class:
declare(strict_types = 1);
namespace VENDOR\MySitePackage\Domain\Finishers;
class CustomFinisher extends \TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher
{
protected $defaultOptions = [
'yourCustomOption' => 'Olli',
];
// ...
}
Further details you have to read in the documentation or ask more detailed.

TYPO3 Powermail: Different recipients depending on formfield?

I have a question (TYPO3 7.6 / Powermail 3.19): Is it possible, to send a form to different recipients depending on the content of a formfield?
To be more exact: I have a mandatory formfield, where a serial number should be filled in. If this number begins with a 3, the form should be send to recipient-1 and if it begins with an 8, recipient-2 should be informed.
Any idea how to make this?
Many thanx :-)
I would use predefined receivers function in powermail - see https://docs.typo3.org/typo3cms/extensions/powermail/ForAdministrators/BestPractice/DynamicReceiver/Index.html
A userFunc could handle the serial number logic.

Angular-material. Autocomplete directive

I have some problem with autocomplete. And my question is: Can I send my own personally typed text instead object from autocomplete list?
When I send object from list to "person.eamil" it's ok, but
when I send normal text to "person.email" I get null instead my text.
Here is my HTML code:
<md-autocomplete
ng-model="person.email"
ng-disabled="false"
md-no-cache="true"
md-selected-item="person.email"
md-search-text-change="setPersonValidEmail(person, !innerForm.email.$error.email);"
md-search-text="searchText"
md-items="item in people"
md-item-text="item.email"
md-min-length="0"
placeholder="some#one.com"
ng-click="addOurPersonIfNecessary($index);"
name = "email">
<md-item-template>
<span md-highlight-text="searchText" md-highlight-flags="^i">{{item.name}}</span>
</md-item-template>
</md-autocomplete>
Md-selected-item here is expecting an object that is populated in people. Only then it can populate the auto complete. You can pass the text to md-search-text
I found solution. Try to use another autocomplete plugin like this:
https://github.com/ghiden/angucomplete-alt

Is it possible to pass post data to the form (prefill form with data)?

For example https://stackoverflow.com/questions/ask there we have form id="post-form" which has method="post", is it possible somehow open this form and have lets say Name input (display-name) with my name prefilled on load?
Yes. You can do this many ways, with Javascript by setting the input's text, or you can do it server-side with PHP by echoing "value=\"$name\"" for the value attribute of the input.

How to loop through a variables in Magento Email Template?

Let's say I've the following variables to pass to my Email Template:
$vars = array(
'products' => $products,
);
Where $products is a collection, how could I iterate over this collection in Email template?
I don't believe that Magento's templating engine is clever enough to do loops. Instead, use an inline block, as Magento does for order items. Something like this:
{{block type='core/template' area='frontend' template='path/to/your/template.phtml' products=$products}}
Hope that helps!
Thanks,
Joe
The above works, but an alternative would be to let your XML do the work by calling the layout handle in the email template:
{{layout handle="email_stuff"}}
In your local.xml or module.xml or where ever you like:
<email_stuff>
<block type="yourblock/type" name="email_stuff" template="path/to/template.phtml" />
</email_stuff>
I guess the main difference is where you're doing most of your email "work". I've used this method for loading in email headers/footers that stay the same in each template. The previous answer is likely simpler for basic tasks, however.