Swift를 사용하여 응용 프로그램에서 HTML 본문이 포함 된 자동 생성 전자 메일을 보내려고합니다.Swift를 사용하여 HTML 전자 메일 보내기
$message = Swift_Message::newInstance()
->setFrom(array('[email protected]' => 'John Doe'))
->setTo('[email protected]')
->setSubject('some subject');
$message->setBody($this->getPartial('global/mail_partial'));
$this->getMailer()->send($message);
이미 일부 특정 스위프트 방법을 사용하여 전자 메일 메시지의 헤더 콘텐츠 유형을 변경하려고했지만 그것이 작동하지 않습니다 :
여기에 내 현재 코드입니다.
안녕하세요! 메시지 본문을 HTML로 설정하면 $ message-> setBody() 메서드에 두 번째 인수를 전달할 수 있다는 것을 발견했습니다. $ message-> setBody ($ this-> getPartial ('global/mail_partial '),'text/html '); 어쨌든 도움 주셔서 감사합니다! 감사합니다. –