Einfache E-Mail mit php versenden.{emailcloak=off}

 

/* Hier Absender eingeben */
$mail_sender = 'company-doe@4uweb.de';

/* Hier Empfänger eingeben */
$mail_recipient = 'john-doe@4uweb.de';

/* Hier optional durch Komma getrennt weitere Empfänger eingeben  */
$mail_recipient_others = array('jack-doe@4uweb.de', 'jane-doe@4uweb.de');

/* Hier Betreff eingeben */
$mail_subject = 'Betreff';

$mail_header = 'MIME-Version: 1.0' . "\r\n";
$mail_header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$mail_header .= 'From: '.$mail_sender. "\r\n";
$mail_header .= 'Reply-To: '.$mail_sender. "\r\n";
$mail_header .= 'X-Mailer: PHP/' . phpversion();
$mail_header .= 'X-Priority: 1 (Normal)'."\r\n";
$mail_header .= 'X-MSMail-Priority: Normal'."\r\n";
$mail_header .= 'Importance: Normal\n'."\r\n";
$mail_subject = '=?UTF-8?B?' . base64_encode($mail_subject) . '?=';

$mail_text  = "I am the mailtext";

mail($mail_recipient, $mail_subject, $mail_text, $mail_header);

if(!empty($mail_recipient_others)){
  foreach($mail_recipient_others as $value){
    mail($value, $mail_subject, $mail_text, $mail_header);
  }
}