php mail () başlıkları sorunu

2 Cevap

İşte benim kod ....

$subject = "This is Subject";
$headers .= 'Content-type: text/html; charset=iso-8859-1';  
$to = 'foo@foo.com';
$body = 'Mail Content Here';        
mail($to, $subject, $body, $headers);

ben bu dosyayı açtığınızda ama $to başarıyla ama yanlış başlıkları ile bir mail gönderir .... ve benim barındırma sunucusu varsayılan adres yani mars.myhosting.com yerine mydomain@domain.com arasında nasıl i can düzeltmek

2 Cevap

Php.net bu bak

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: Webmaster <webmaster@example.com>' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Üstbilgi ekle

İşte PHP ile ne yapardınız:

<?PHP

$to = 'email@address.com';
$subject = 'desired subject';
$message = 'desired message';
$headers = 'From: example@email.com' . "\r\n" .
   'Reply-To: example@email.com' . "\r\n" .
   'Return-Path: example@email.com' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

?>

Ben bazı yardımcı olur umarım :)