my $nachricht = param('nachricht'); my $betreff = param('betreff'); my $empfaenger = param('empfaenger'); if(defined($nachricht) && defined($betreff) && defined($empfaenger)){ $select = $db->prepare (" SELECT email_adresse FROM login WHERE user='$session_user'; "); $select->execute; my $absender; while(@result = $select->fetchrow_array){ $absender = $result[0]; } my $mailServer = "smtp.eigene.domain.de"; my $smtp = Net::SMTP->new($mailServer); $smtp->mail($absender); $smtp->to($empfaenger); $smtp->data(); $smtp->datasend("Subject: $betreff\n"); $smtp->datasend("To: $empfaenger\n"); $smtp->datasend("\n"); $smtp->datasend("$nachricht"); $smtp->dataend(); $smtp->quit; }