Jump to content

Edit History

PixGeek

PixGeek

il y a 16 minutes, Eolia a dit :

Ok, vous devez avoir un override de la classe Mail.php car dans la version d'origine vous auriez le message d'erreur Swift (erreur de port ou de réponse).

Veuillez vérifier svp.

j'ai ce fichier qui est en lien avec un module de paiement !

<?php
if (! defined('_PS_VERSION_')){
	exit();
}
$modulePath = rtrim(_PS_MODULE_DIR_, '/') . '/mailhook/';
require_once $modulePath . 'MailMessage.php';
require_once $modulePath . 'MailMessageAttachment.php';
require_once $modulePath . 'MailMessageEvent.php';
class Mail extends MailCore{
	
	/*
    * module: mailhook
    * date: 2024-06-11 15:52:45
    * version: 1
    */
    public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, 
			$file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null,
		$replyToName = null) {
		
		$message = new MailMessage();
		$message
			->setLangId($id_lang)
			->setTemplateName($template)
			->setSubject($subject)
			->setTemplateVariables($template_vars)
			->setToEmailAddress($to)
			->setToName($to_name)
			->setFromEmailAddress($from)
			->setFromName($from_name)
			->setTemplateFolderPath($template_path)
			->setModeSMTP($mode_smtp)
			->setShopId($id_shop)
			->setBcc($bcc)
			->setReplyTo($reply_to)
			->setReplyToName($replyToName)
		;
		if ($file_attachment !== null) {
			$message->setFileAttachment(new MailMessageAttachment($file_attachment));
		}
		
		$event = new MailMessageEvent($template);
		$event->setDie($die);
		$event->addMessage($message);
		
		self::executeMailSendingHook($event);
		return self::processMailEvent($event);
	}
	
	
	/*
    * module: mailhook
    * date: 2024-06-11 15:52:45
    * version: 1
    */
    public static function sendMailWithoutHook($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, 
		$file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null, $replyToName = null) {
		return parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to, $replyToName);
	}
	
	
	/*
    * module: mailhook
    * date: 2024-06-11 15:52:45
    * version: 1
    */
    public static function sendMailMessageWithoutHook(MailMessage $message, $isDie) {
		$file_attachment = null;
		if ($message->getFileAttachment() !== null) {
			$file_attachment = $message->getFileAttachment()->toArray();
		}
		return self::sendMailWithoutHook(
			$message->getLangId(),
			$message->getTemplateName(),
			$message->getSubject(),
			$message->getTemplateVariables(),
			$message->getToEmailAddress(),
			$message->getToName(),
			$message->getFromEmailAddress(),
			$message->getFromName(),
			$file_attachment,
			$message->getModeSMTP(),
			$message->getTemplateFolderPath(),
			$isDie,
			$message->getShopId(),
			$message->getBcc(),
			$message->getReplyTo(),
			$message->getReplyToName()
		);
	}
	
	
	/*
    * module: mailhook
    * date: 2024-06-11 15:52:45
    * version: 1
    */
    protected static function executeMailSendingHook(MailMessageEvent $event) {
		Hook::exec('actionMailSend', array(
			'event' => $event
		));
	}
	
	/*
    * module: mailhook
    * date: 2024-06-11 15:52:45
    * version: 1
    */
    protected static function processMailEvent(MailMessageEvent $event) {
		$numberOfSuccessfulRecipients = 0;
		foreach ($event->getMessages() as $message) {
			$rs = self::sendMailMessageWithoutHook($message, $event->isDie());
			if ($rs !== false) {
				$numberOfSuccessfulRecipients = $rs + $numberOfSuccessfulRecipients;
			}
		}
		
		if ($numberOfSuccessfulRecipients > 0) {
			return $numberOfSuccessfulRecipients;
		}
		else {
			return false;
		}
	}
	
}

 

PixGeek

PixGeek

il y a 8 minutes, Eolia a dit :

Ok, vous devez avoir un override de la classe Mail.php car dans la version d'origine vous auriez le message d'erreur Swift (erreur de port ou de réponse).

Veuillez vérifier svp.

j'ai ce fichier qui est en lien avec un module de paiement !

 

 

×
×
  • Create New...