mail() function and Hotmail !

Discussion in 'PHP' started by Yazari, Aug 20, 2006.

  1. #1
    Hello everybody,

    My probleme is when i send an email using the integrated php mail fuction.. it go to junkmail..

    is there any method to solve this probleme ?

    i heared about using good headers.. i used alot of examples but none is working :(


    Can you please help with this !
    Thank You.
     
    Yazari, Aug 20, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need the from address to be the same as the sendmail address in the php.ini file or big ISPs will indeed junk it.
     
    T0PS3O, Aug 20, 2006 IP
  3. Yazari

    Yazari Peon

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    how can i get it ?
     
    Yazari, Aug 20, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Open php.ini in an editor, find sendmail_from and edit the line or whatever.
     
    T0PS3O, Aug 20, 2006 IP
  5. danielbruzual

    danielbruzual Active Member

    Messages:
    906
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    70
    #5
    Use phpmailer, it usually gets emails past the junk mail filter.
     
    danielbruzual, Aug 20, 2006 IP
  6. Yazari

    Yazari Peon

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i use Shared hosting..

    danielbruzual i want to use mail() in my script..
     
    Yazari, Aug 20, 2006 IP
  7. danielbruzual

    danielbruzual Active Member

    Messages:
    906
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    70
    #7
    You probably should send the correct email headers, which you should be able to recycle from phpmailer (I'm not sure).

    
    	$eol="\n"; 
    	$emailsubject="Here's An Email From Your Site-".date("Y/m/d H:i:s"); 
    	$headers = 'From: '.$from.' <'.$email.'>'.$eol;
    	$headers .= 'Reply-To: '.$from.' <'.$email.'>'.$eol;
    	$headers .= 'Return-Path: '.$from.' <'.$email.'>'.$eol;   
    	$headers .= "Message-ID: < TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
    	$headers .= "X-Mailer: PHP v".phpversion().$eol;          // This helps avoid spam filters
    
    	mail($emailaddress, $emailsubject, $msg, $headers);
    
    
    Code (markup):
    just give a value to the variables and it should work.
     
    danielbruzual, Aug 20, 2006 IP
  8. banias

    banias Peon

    Messages:
    4
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    mail ($mail2who, $subject, $mesaJ ) ;

    // ;) dont write from parameter to learn default mail address
     
    banias, Aug 20, 2006 IP
  9. hiredgunz

    hiredgunz Peon

    Messages:
    203
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I've had good luck using these headers added on:

    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    /* additional headers */

    $headers .= "From: your site email address \r\n";

    /* and now mail it */

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

    best,

    Jan
     
    hiredgunz, Aug 28, 2006 IP