Reputation: 448
For last few hours I have been trying to send signed mail using swiftmailer via sendgrid SMTP server I'm successful with sending signed text emails but when I try to send html content in email sendgrid changes something and the signature becomes invalid any idea how to dump email before sending to know what is wrong? Or how to fix it?
PS: I have already disabled tracking pixel and it works with amazon.
Mailer config:
$this->transport = Swift_SmtpTransport::newInstance($config['host'], 587, 'tls')
->setUsername($config['key'])
->setPassword($config['secret']);
$this->mailer = \Swift_Mailer::newInstance($this->transport);
Message:
$message = Swift_Message::newInstance($subject)
->setFrom(array($from => $from))
->setTo(array($receiver => $receiver));
Signer:
$smimeSigner = new \Swift_Signers_SMimeSigner();
$smimeSigner->setSignCertificate(env("S_MIME_CERT"), [env("S_MIME_KEY"), env("S_MIME_PASS")]);
$message->attachSigner($smimeSigner);
Sending:
$sent = $this->mailer->send($message);
Upvotes: 0
Views: 201
Reputation: 448
Fixed. Problem was that sendgrid uses different separators and they were replacing LF to CR LF so I changed all separators to CR LF before sending
Upvotes: 1