Email in php !!!

Discussion in 'PHP' started by pulikuttann, Mar 27, 2007.

  1. #1
    I have created a simple mail function prg in php.But I need to add more !!!



     
    pulikuttann, Mar 27, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    what do you need it to do ?
     
    krakjoe, Mar 27, 2007 IP
  3. pulikuttann

    pulikuttann Banned

    Messages:
    1,839
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to add form,and add a fake header !!!
     
    pulikuttann, Mar 27, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Sppofing headers isn't something I'll show you how to do, however :

    
    <?
    if( $_POST ):
    	if( !mail( $_POST['to'], $_POST['subject'], nl2br( $_POST['message'] ), "Content-type: text/html\r\n".
    																		   "From: $_POST[from] <$_POST[from]>\r\n" ) ):
    		$messages = sprintf( 
    					"When attempting to mail %s @ %s on %s I have encountered an error",
    					$_POST['to'],
    					date( "h:m:s", time( ) ),
    					date( "F m y", time( ) )
    		 			);
    	else :
    		$messages = sprintf(
    					"Message queued for delivery to %s",
    					$_POST['to']
    					);
    	endif;
    endif;
    ?>
    <?=$messages ?>
    <form action="" method="post" >
    To :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="to" /><br />
    From :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="from" /><br />
    Subject :&nbsp;&nbsp;&nbsp;   <input type="text" name="subject" /><br />
    Message :<br />
    <textarea rows="10" cols="30" name="message"></textarea><br />
    <input type="submit" value="Send Email" />
    </form>
    
    PHP:
     
    krakjoe, Mar 27, 2007 IP
    ryan_uk likes this.
  5. boyponga

    boyponga Banned

    Messages:
    1,013
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You need to put the sender too. :)
     
    boyponga, Mar 27, 2007 IP