코드 본문에 비 ASCII 문자로 이메일을 보내 이메일을 보낼 수 없습니다 (작업 좋은) :펄 SMTP :
: 최대한 빨리 몸에 비 ASCII 문자를 추가#!/usr/bin/perl
use utf8;
use strict;
use warnings;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP();
use Email::Simple();
use open ':std', ':encoding(UTF-8)';
sub send_email
{
my $email_from = shift;
my $email_to = shift;
my $subject = shift;
my $message = shift;
my $smtpserver = 'smtp.gmail.com';
my $smtpport = 465;
my $smtpuser = '[email protected]';
my $password = 'secret';
my $transport = Email::Sender::Transport::SMTP->new({
host => $smtpserver,
port => $smtpport,
sasl_username => $email_from,
sasl_password => $password,
debug => 1,
ssl => 1,
});
my $email = Email::Simple->create(
header => [
To => $email_to,
From => $email_from,
Subject => $subject,
],
body => $message,
);
$email->header_set('Content-Type' => 'text/html');
$email->header_set('charset' => 'UTF-8');
sendmail($email, { transport => $transport });
}
send_email('[email protected]', '[email protected]', 'Hello', 'test email');
send_email('[email protected]', '[email protected]', 'Hello', 'test email. Русский текст');
는 디버그 출력의 마지막 메시지와 함께 응답 :
Net::SMTP::_SSL=GLOB(0x8d41fa0)>>> charset: UTF-8
Net::SMTP::_SSL=GLOB(0x8d41fa0)>>>
Net::SMTP::_SSL=GLOB(0x8d41fa0)>>> test email. Русский текст
Net::SMTP::_SSL=GLOB(0x8d41fa0)>>> .
어떻게 해결?