How to set a custom header using phpmailer - email

I am using phpmailer for sending emails, but I want to make a custom header for my company, by adding a textarea field that contain any custom header for example using a header like this one:
exemple of header
or any other header types..
How can I do this , thanks in advance.

You will need to do some discovery and modification of the default headers set by PHPmailer for this to be achieved.
You will need to use different functions to set/edit headers depending on the type of header you want to set/edit. Here are a few examples:
From:
$mail->setFrom('from#example.com', 'Mailer');
Subject:
$mail->Subject = 'Here is the subject';
Custom:
$mail->addCustomHeader('X-custom-header', 'custom-value');
In short, It is quite an effort to do this when the headers are free-typed in a text box. It is however doable with detection and validation on your side.

Related

OpenSips Remove Header Value

I'm new to OpenSips.
I have a requirement to remove a single value from header values.
Now it has
Allow: INVITE,REFER,ACK,NOTIFY
We need to remove REFER from Allow header and leave the rest
Expected Result
Allow: INVITE,ACK,NOTIFY
I have written custom logic to get the header value & remove REFER, then Remove entire header & add new header without REFER.
But, is there any predefined functions available to achieve above requirement?

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.

Where to set Content Language for email?

Sending HTML emails in different languages, such as English and French.
Is it a best practice to set the Content-Language header in the
HTML lang tag: <html lang="fr">
Email header Content-Language
Both
This works:
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" />
TL;DR: You can set the Content-Language in the header. If your mail is a multipart message with alternatives in other languages (e.g. when you send a mail with translations), you can set a different one in the headers for those alternatives.
There are two RFC's of interest here RFC 3282 about Content-Language headers and RFC 2045 about message bodies.
From 2045 section 9
Additional MIME Header Fields
Future documents may elect to define additional MIME header fields
for various purposes. Any new header field that further describes
the content of a message should begin with the string "Content-" to
allow such fields which appear in a message header to be
distinguished from ordinary RFC 822 message header fields.
MIME-extension-field := <Any RFC 822 header field which
begins with the string
"Content-">
And from 2045 section 3 you can conclude that an extra Content-Language header can be set on every body part for multipart messages.
If you like seeing examples, the Mozilla comm-central repo (Thunderbird and other MUA's) has some nice test data with examples: https://hg.mozilla.org/comm-central/file/tip/mailnews/test/data
If you are reading this in the future, you may be able to convey the language in the character set RFC 2231.

Change ActiveX email font

Would anyone know how to change the font in an email generated by new ActiveXObject("Outlook.Application")?
This seems to default to Times New Roman regardless of the default settings in the mail client.
Thanks
The Outlook object model provides three main ways for working item bodies:
Body - a string representing the clear-text body of the Outlook item.
HTMLBody - a string representing the HTML body of the specified item.
Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.
You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the message body. But the last two ways allows to choose a font.

AEM/CQ - Sling script resolution - what script to use?

We have requirement wherein we are required to create some URLs that will be using selectors. The URL that we use currently is
<company>/<domain>/home.html
In addition to the above URL we will be having three more URLs of type:
URL 1 - <company>/<domain>/home.<brand>.html
There can be three possible values of brand. Let's say A, B and C.
Now the template (sling:resourceType --> /apps/components/page/basepage) that <company>/<domain>/home.html uses has sling:resourceSuperType set as foundation/components/page.
/apps/components/page/basepage has only body.jsp.
The body.jsp includes components like footer and header using cq:include. Depending upon the selector used in the URL, some minor changes have to be reflected in the footer and header. Like header image and some text in the footer.
How can I achieve this ?
Thanks in advance
The solution is pretty simple. All we need to do is include the scripts A.jsp, B.jsp and C.jsp under the component nodes. So, that means under the footer and header component nodes. There will be three more jsps now.