Thread Problem mit sendmail (HTML-Mail erzeugen und senden) (51 answers)
Opened by carsten1976 at 2010-03-27 01:36

GwenDragon
 2010-03-27 17:13
#135373 #135373
User since
2005-01-17
14533 Artikel
Admin1
[Homepage]
user image
HTML-Mails erzeugen?
Geht auch so mit den folgenden Modulen:
MIME-Lite oder Email-MIME-CreateHTML

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use MIME::Lite;
my $msg = MIME::Lite->new(
         To      =>'you@yourhost.com',
         Subject =>'HTML with in-line images!',
         Type    =>'multipart/related'
    );
$msg->attach(
        Type => 'text/html',
        Data => qq{
            <body>
                Here's <i>my</i> image:
                <img src="cid:myimage.gif">
            </body>
        },
    );
$msg->attach(
        Type => 'image/gif',
        Id   => 'myimage.gif',
        Path => '/path/to/somefile.gif',
    );
$msg->send();


Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Email::MIME::CreateHTML;
my $email = Email::MIME->create_html(
    header => [
      From => 'my@address',
      To => 'your@address',
      Subject => 'Here is the information you requested',
    ],
    body => $html,
    text_body => $plain_text
);

use Email::Send;
my $sender = Email::Send->new({mailer => 'SMTP'});
$sender->mailer_args([Host => 'smtp.example.com']);
$sender->send($email);
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread Problem mit sendmail (HTML-Mail erzeugen und senden)