#!/usr/bin/perl use warnings; use strict; require Net::SMTP; require IO::Socket::SSL; IO::Socket::SSL->import(qw(SSL_VERIFY_CLIENT_ONCE)); my $user = 'me@mail.de'; my $pass = '123456'; my $server = 'smtp.strato.de'; my $to = 'test@mail.de'; my $from_name = 'Testaccount'; my $from_email = 'imaptest@mail.de'; my $subject = 'test'; # Verbindungsherstellung my $smtps = Net::SMTP->new( $server, SSL_verify_mode => SSL_VERIFY_CLIENT_ONCE(), ) or do { print "Keine Kommunikation mit dem SMTP-Server 'URL' möglich"; return 0; }; defined ($smtps->auth($user, $pass)) or die "Can't authenticate: $!\n"; $smtps->mail($from_email); $smtps->to($to); $smtps->data(); $smtps->datasend("To: $to\n"); $smtps->datasend(qq^From: "$from_name" <$from_email>\n^); $smtps->datasend("Subject: $subject\n\n"); $smtps->datasend("This will be the body of the message.\n"); $smtps->datasend("\n--\nVery Official Looking .sig here\n"); $smtps->dataend(); $smtps->quit(); print "done\n";