|
-
Mar 11th, 2010, 04:29 PM
#1
Thread Starter
Lively Member
mail() not working with headers
Hello all.
Once I put in the following headers, mail() stopped working. When I take them out, it works. Any clues? Thanks.
PHP Code:
$headers='';
$headers.='From: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='To: '.$array[0]['first_name'].' '.$array[0]['last_name'].' <'.$array[0]['txt_username'].'>'."\n";
$headers.='Reply-To: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='Date: '.date("r")."\n";
$headers.='Return-Path: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='MIME-Version: 1.0'."\n";
$headers.='Content-type: text/html;charset=UTF-8'."\n";
-
Mar 11th, 2010, 05:11 PM
#2
Re: mail() not working with headers
Echo out $headers after all of your variables have been inserted and see if they're valid. On the "To:" line, is $array[0]['txt_username'] an email address?
-
Mar 11th, 2010, 08:49 PM
#3
Re: mail() not working with headers
try using a carriage return as well as a new line character:
but, Samba's suggestion could also be the problem.
-
Mar 14th, 2010, 04:59 AM
#4
Re: mail() not working with headers
 Originally Posted by solitario
Hello all.
Once I put in the following headers, mail() stopped working. When I take them out, it works. Any clues? Thanks.
PHP Code:
$headers='';
$headers.='From: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='To: '.$array[0]['first_name'].' '.$array[0]['last_name'].' <'.$array[0]['txt_username'].'>'."\n";
$headers.='Reply-To: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='Date: '.date("r")."\n";
$headers.='Return-Path: '.$sending_name.' <'.$sending_email.'>'."\n";
$headers.='MIME-Version: 1.0'."\n";
$headers.='Content-type: text/html;charset=UTF-8'."\n";
As well as complying with the RFC 2821 and terminating headers with <CRLF>, you should also ensure that the variables you have inserted into the headers do not contain <CRLF> (especially if they originate from a user entered form).
If you do not do this, a malicious user could insert their own headers (e.g. Cc:, Bcc: and attachments). Your web form could then be used as a spamming engine for Viagra pills
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|