Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

Send UTF-8 encoded mail with Email::Sender

$
0
0

I'm trying to send an mail with Email::Sender which contains umlauts.

#!/usr/bin/perl

use strict;
use warnings;

use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP::TLS;
use Email::Simple ();
use Email::Simple::Creator ();

open(my $mailbody, "<", "mail-content");

my $smtpserver = 'smtp.gmail.com';
my $smtpport = 587;
my $smtpuser   = 'example@mail.de';
my $smtppassword = 'password';

my $transport = Email::Sender::Transport::SMTP::TLS->new({
  host => $smtpserver,
  port => $smtpport,
  username => $smtpuser,
  password => $smtppassword,
});

my $email = Email::Simple->create(
  header => [
    To      => 'example@mail.de',
    From    => 'example@mail.de',
    Subject => 'Mail',
  ],
  body => <$mailbody>,
);

sendmail($email, { transport => $transport });

The received mail looks like gegrÃŒÃt instead of gegrüßt.
Is there any way i can specify how the mail is getting encoded in perl?


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>