TYPO3 Powermail: Different recipients depending on formfield? - typo3

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.

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 access values directly

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}.

Specify table/column/cell widths in Outlook email from SAS

Is it possible to specify table/column/cell widths of a HTML table in Outlook using proc print?
I've tried defining templates and specifying via styles and the tagattr option.
Using the style= option on proc print.
Formatting emails for certain clients (Outlook, gmail, yahoo etc) is a job role all in itself. There are books written on the subject, but a primer can be found here. The short answer is that no, it is not possible using proc print.. instead you are going to have to generate very specific HTML and CSS in order to get around the rules applied by the Outlook rendering engine.
For instance, Outlook will strip all of your default styles - they have to be applied as attribute specific styles (eg <table style="width:300px">) .
Further tips here, but many can be found with a keyword search on "outlook email styles"..
No it is not possible. I just spent 4 hours trying every permutation of every option available.

Kentico CMS: Form Validation - At least one input answered

I have a simple feedback form in a Kentico CMS site.
There are two inputs and a submit button. One of the inputs is a yes/no radio button selection and the other is a text area input. (please see screenshot).
I want the user to be able to submit the form only when at least one of the following 3 criteria are met:
'Was this page helpful?' was answered.
The text area value is not blank and the value does not equal the default text value which is 'How can we improve this page? Providing feedback helps us to improve this information'
Or, both criteria in 1 and 2 are met.
Basically, I want them to answer at least one of the inputs.
Is this type of validation possible using Kentico forms/online form web part?
Screenshot of form (may be of use):
I contacted Kentico about this functionality and their response is below:
Regrettably, this type of validation is not provided. Kentico CMS
perform validation for each built-in control separately.
In general, you have two options. The first one is to implement the
OnBeforeValidate or OnAfterValidate events which give you the ability
to perform a custom validation if necessary. You can access each field
as follows:
string answerText =
ValidationHelper.GetString(viewBiz.BasicForm.Data.GetValue("answerText"),
"");
If the validation fails, you need to set the StopProcessing of the
BizForm control to true:
viewBiz.StopProcessing = true;
More information about customization possibilities related to BizForm
can be found here:
http://devnet.kentico.com/docs/devguide/index.html?api_bizforms_customization_possibilities.htm
Another way would be creating a custom form control just as it is
described in the documentation:
http://devnet.kentico.com/docs/devguide/developing_form_controls.htm
The form control would allow users to specify both fields and
therefore you can peform the custom validation (IsValid method)
according to your requirements.
To set a field other than the field for which the for control is used,
you need to implement the GetOtherValues method.
Then, just disable the other field so that it is not displayed on the
form twice.

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.