Commit 82495c96 authored by APolitsin's avatar APolitsin
Browse files

phpmail_alter

parent 484fa736
<?php
namespace Drupal\synhelper\Hook;
use Drupal\Core\Controller\ControllerBase;
use Drupal\synhelper\Controller\IdnaConvert;
/**
* PreprocessHtml.
*/
class PhpmailAlterFromAlter extends ControllerBase {
/**
* Hook.
*/
public static function hook(&$mail) {
$idn = new IdnaConvert();
$mail = trim($mail);
$user = strstr($mail, '@', TRUE);
$domain = strstr($mail, '@');
$domain = substr($domain, 1);
if (strpos($domain, '>')) {
$domain = str_replace('>', '', $domain);
$domain = $idn->encode($domain) . '>';
}
else {
$domain = $idn->encode($domain);
}
$mail = "{$user}@{$domain}";
dsm($mail);
}
}
......@@ -16,11 +16,19 @@ use Drupal\synhelper\Hook\FormNodePageFormAlter;
use Drupal\synhelper\Hook\FormNodePageEditFormAlter;
use Drupal\synhelper\Hook\EntityPresave;
use Drupal\synhelper\Hook\CssAlter;
use Drupal\synhelper\Hook\PhpmailAlterFromAlter;
use Drupal\synhelper\Hook\FormUpdateManagerInstallFormAlter;
use Drupal\synhelper\Hook\FormFieldUiFieldStorageAddFormAlter;
use Drupal\synhelper\Hook\FormNodeTypeAddFormAlter;
use Drupal\synhelper\Hook\FormFieldConfigEditFormAlter;
/**
* Implements hook_cmlexchange_orders_query_alter().
*/
function synhelper_phpmail_alter_from_alter(&$mail) {
PhpmailAlterFromAlter::hook($mail);
}
/**
* Implements hook_entity_presave().
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment