Re: [PHP] Mail Problem

2006-09-26 Thread travis
 I have an issue with sending email via PHP which may be a configuration 
 problem with either PHP, Apache, or possibly a Sendmail, but I don't know 
 which yet.  I figured I'd start here first.
 
 Here's the situation.  I have several webpages that send email to users for 
 various reasons.  We have our webserver, an intranet webserver, configured to 
 connect to our smtp server which sits on a different box. The script looks 
 like this:
 
 ?PHP
 $from = [EMAIL PROTECTED];
 $to = [EMAIL PROTECTED];
 $subject = Test;
 $msg = This is a test from my sitennTimestamp:  . date(r);
 $headers = From:$fromrn;
 if(!mail($to,$subject,$msg,$headers)) { die(Unable to send); }
 ?
 
 This works great when it works. Users receive email as expected and when they 
 hit reply it goes back to the webmaster email address.  The problem is if the 
 to email address isn't a valid one.  When this happens, the mail server 
 bounces the message back to [EMAIL PROTECTED] instead of [EMAIL PROTECTED]
 
 I've tried adding reply-to to the mail headers and that doesn't work either.  
 We tried sending the same failed message using webmin and that worked great, 
 which is why I believe this to be a PHP or Apache problem.



Is it a UNIX box?  Sendmail takes the -f parameter in your php.ini to configure 
its envelope from address... Does not extract it from message headers.  The 
fifth argument to mail() also supports doing this if you need to change it on a 
per-mail basis.  I would just set it in php.ini. (like: sendmail_path = 
'/usr/bin/sendmail -f [EMAIL PROTECTED]')

If its a Win box there is a sendmail_from config param in php.ini.

php.net/manual/function.mail.php read for 'Additional Params' the fifth 
argument, it specifically deals with this case.

Travis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Richard Lynch
On Tue, September 26, 2006 11:09 am, [EMAIL PROTECTED] wrote:
 I have an issue with sending email via PHP which may be a
 configuration problem with either PHP, Apache, or possibly a Sendmail,
 but I don't know which yet.  I figured I'd start here first.

 Here's the situation.  I have several webpages that send email to
 users for various reasons.  We have our webserver, an intranet
 webserver, configured to connect to our smtp server which sits on a
 different box. The script looks like this:

 ?PHP
 $from = [EMAIL PROTECTED];
 $to = [EMAIL PROTECTED];
 $subject = Test;
 $msg = This is a test from my site\n\nTimestamp:  . date(r);
 $headers = From:$from\r\n;

Add a space after the ':' to be kosher.

Add a Reply-To:
Add an Errors-to: (I think?)

 if(!mail($to,$subject,$msg,$headers)) { die(Unable to send); }

*IF* you are using PHP5 (?) and *IF* your security settings allow it,
the optional fifth argument will let you specify the real sender of
the message, which the responder may or may not be using to bounce to.

http://php.net/mail

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Richard Lynch
On Tue, September 26, 2006 11:16 am, Kevin Murphy wrote:
 Why not validate the email address before you send. I use something
 like this to kick back an error that says you put in a bad email
 address. It won't tell you about a wrong email address, but it will
 tell you if they forgot to put in the @ sign and stuff.

 if  (!preg_match(/^(.+)@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si, $data))
 { $email_error = yes;   }

Given that the *correct* PCRE expression for a valid email address is
3 pages long, the odds that yours is not rejecting some valid address
seem rather slim to me.

The . between the 9 and the - is not escaped, and renders the rest of
the characters in that class superfluous.

But let's suppose your PCRE actually proved the email syntactically
valid.

That's got *NOTHING* to do with the email generating a bounce or not!

There are a zillion times as many syntactically valid emails as there
are ones that don't bounce, never mind the even smaller class of email
addresses that actually go somewhere, and the even smaller class of
email addresses that a human reads on a regular basis.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Travis Doherty
Richard Lynch wrote:

if(!mail($to,$subject,$msg,$headers)) { die(Unable to send); }



*IF* you are using PHP5 (?) and *IF* your security settings allow it,
the optional fifth argument will let you specify the real sender of
the message, which the responder may or may not be using to bounce to.

http://php.net/mail
  

Richard is correct on that. The fifth argument isn't only for the
envelope sender, so ensure you include the '-f' for sendmail and compat.
wrappers.

php.net/mail: ChangeLog:
4.0.5 The additional_parameters parameter was added.

... which the responder may or may not be using to bounce to.
  

They should *always* be sending to the envelope from address (SMTP `MAIL
FROM` command), with an empty envelope sender (SMTP `MAIL FROM:`) to
avoid loops.

The RFC's are a rather in depth, so here is an excerpt from Wikipedia
that pretty much sums up what the RFCs do contain:
[http://en.wikipedia.org/wiki/Bounce_message]

 The Return-Path is visible in delivered mail as header field
 Return-Path inserted by the final SMTP mail transfer agent
 http://en.wikipedia.org/wiki/Mail_transfer_agent (MTA), also known
 as mail delivery agent
 http://en.wikipedia.org/wiki/Mail_delivery_agent (MDA). The MDA
 simply copies the *reverse path* in the SMTP MAIL FROM command into
 the Return-Path. The MDA also removes bogus Return-Path header fields
 inserted by other MTAs, this header field is generally guaranteed to
 reflect the last reverse path seen in the MAIL FROM command.


Travis Doherty

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Richard Lynch
On Tue, September 26, 2006 5:08 pm, Travis Doherty wrote:
 They should *always* be sending to the envelope from address (SMTP
 `MAIL
 FROM` command), with an empty envelope sender (SMTP `MAIL FROM:`) to
 avoid loops.

There was a brief period in time where there was an Errors-to: header
that some MTAs where using...

I got no idea if they were just ignoring RFCs (Microsoft) or the RFCs
changed or what...

But adding the Errors-to: header may solve things for a tiny
percentage of legacy (broken) MTAs.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Richard Lynch
On Tue, September 26, 2006 5:08 pm, Travis Doherty wrote:
 The RFC's are a rather in depth, so here is an excerpt from Wikipedia
 that pretty much sums up what the RFCs do contain:
 [http://en.wikipedia.org/wiki/Bounce_message]

For awhile, I've been pondering the advisability of sending a Bounce
for some spam -- the ones where I think it's a more or less honorable
company, with some idiots running it, and I want off their list, and
other actions have so far failed.

So, if I code a PHP IMAP app to let me send a Bounce for one
message, is that going to screw my because some MTA will cache that
Bounce status and start bouncing other mail?...

Yeah, okay, the question is sorta off-topic, but it will get coded in
PHP if it's safe to do so...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Curt Zirzow

On 9/26/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, September 26, 2006 11:09 am, [EMAIL PROTECTED] wrote:
 I have an issue with sending email via PHP which may be a
 configuration problem with either PHP, Apache, or possibly a Sendmail,
 but I don't know which yet.  I figured I'd start here first.

 Here's the situation.  I have several webpages that send email to
 users for various reasons.  We have our webserver, an intranet
 webserver, configured to connect to our smtp server which sits on a
 different box. The script looks like this:

 ?PHP
 $from = [EMAIL PROTECTED];
 $to = [EMAIL PROTECTED];
 $subject = Test;
 $msg = This is a test from my site\n\nTimestamp:  . date(r);
 $headers = From:$from\r\n;

Add a space after the ':' to be kosher.

::cough::rfc compliant::cough::)



Add a Reply-To:
Add an Errors-to: (I think?)


Yeah these can help in finding out the problem, the Errors-To: header
is usually used when the original message  can't be delivered, if the
server handling the message supports it will send to that header
instead of the envelope addressee. The Reply-To, is more for the
client software, iirc.




 if(!mail($to,$subject,$msg,$headers)) { die(Unable to send); }

*IF* you are using PHP5 (?) and *IF* your security settings allow it,
the optional fifth argument will let you specify the real sender of
the message, which the responder may or may not be using to bounce to.


php4 allows the '5th' param as well, but the safe_mode paramater does
affect if you are able to use this.

Curt.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Problem

2006-09-26 Thread Curt Zirzow

On a side note.. have i ever mentioned the email system really sucks.

Curt.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() help

2006-09-12 Thread suresh kumar
Hi,
  I  am using php mail function to send mails to our customers.but when i 
send mail to them.it is getting received in customers bulk folder .i want mail 
to get received in customers inbox.i dont know the reason why its getting 
stored in bulk folder.
   
   i attached the code.below,any one help me

  $to='[EMAIL PROTECTED]';

$subject='Password from MyAdTV';

$headers  = 'MIME-Version: 1.0' . \r\n;

$headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;

$headers .= 'From: MyADTV asureshkumar_1983'@yahoo.co.in' . \r\n;

$headers.= 'X-Mailer: PHP/' . phpversion(). \r\n;

$sendmessage = brHere is the information you requestedbrbrYour 
Logon name and Password details for MyADTV Accountbrbrb your LogonName is 
/b: suresh brbrb your Password is /b rajaysbrbrIf You Want To 
Login into Your MyADTV Account,a 
href=\Click'http://myadtv.com/login.php\;Click Here/abrbr;
  
   
 mail($to,$subject,$sendmessage,$headers);
  

Christopher Weldon [EMAIL PROTECTED] wrote:
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

suresh kumar wrote:
 Hi to all,
 i am having one doubt regarding php mail function.i am using php mail() 
 function to send mail to the users.but when i send mail throught php its 
 going to the users bulk folder but not to the user inbox.i dont know the 
 reason.
 
 Is there any setting that is requried in the php.ini file (or) the user have 
 to change their setting in their mail (or) is there any option available to 
 send mail to the user inbox.tnxs for reply
 
 A.suresh
 
 
 
 
 -
 Find out what India is talking about on - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
 NOW

There are several things you need to check for, and probably add to your
emails that you're sending.

Number one, add additional headers to make SPAM / Bulk filters realize
the message is not SPAM or should not be considered SPAM. IE:

$headers = From: Suresh Kumar \r\n.
X-Mailer: PHP 4.3.2\r\n.
X-Sender: $_SERVER['HTTP_HOST']\r\n.
X-Comment: If you can put a comment here, do it.\r\n;

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

The above is considering you have already declared the $to, $subject,
and $body variables. Also, make sure your $subject is not
'undisclosed-recipients;' or something like that - it's a big no-no and
will definitely flag some SPAM filters. Put a valid e-mail address - but
you can still use the BCC-headers and everything should go just fine.
Alternatively, if your list is not too large, it looks better to run a
for / while loop to send each recipient a message directly (ie: not
using BCC) as that will cut down on the SPAM probability.

Second, if you are making MIME emails, make sure you are doing so
correctly. You can learn about creating multipart/alternative MIME
emails more at www.php.net/mail.

Finally, if none of the above works, it would be helpful for us to see
the headers of the received message from one of your recipients where
the message was put in the BULK folder.

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBaG2Zxvk7JEXkbERAgZiAKCJVQfno2fAca13Sx7aXPWD2WMgUwCeOMBX
grbViYDnAXXy8l1i4liVHzE=
=ka5I
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-
 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW

Re: [PHP] mail() help

2006-09-12 Thread David Tulloh
Your email is going to the bulk mail folder because the email provider
believes that it's spam.  It's nothing specifically wrong with your
email, there is no this isn't spam flag, otherwise everyone would set it.

To figure out why the email is being marked as spam, check the program
that is doing the filtering.  Most of the filtering programs will list
the tests which matched in the headers.  You can then try and fix the
problems highlighted.

A few suggestions from what you provided below, I believe your From
header is incorrect.  You could try not sending HTML in the message or
sending properly formed and MIME typed HTML, along with a non-HTML version.


David

suresh kumar wrote:
 Hi,
   I  am using php mail function to send mails to our customers.but when i 
 send mail to them.it is getting received in customers bulk folder .i want 
 mail to get received in customers inbox.i dont know the reason why its 
 getting stored in bulk folder.

i attached the code.below,any one help me
 
   $to='[EMAIL PROTECTED]';
 
 $subject='Password from MyAdTV';
 
 $headers  = 'MIME-Version: 1.0' . \r\n;
 
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
 
 $headers .= 'From: MyADTV asureshkumar_1983'@yahoo.co.in' . 
 \r\n;
 
 $headers.= 'X-Mailer: PHP/' . phpversion(). \r\n;
 
 $sendmessage = brHere is the information you requestedbrbrYour 
 Logon name and Password details for MyADTV Accountbrbrb your LogonName 
 is /b: suresh brbrb your Password is /b rajaysbrbrIf You Want 
 To Login into Your MyADTV Account,a 
 href=\Click'http://myadtv.com/login.php\;Click Here/abrbr;
   

  mail($to,$subject,$sendmessage,$headers);
   
 
 Christopher Weldon [EMAIL PROTECTED] wrote:
   -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 suresh kumar wrote:
 
Hi to all,
i am having one doubt regarding php mail function.i am using php mail() 
function to send mail to the users.but when i send mail throught php its 
going to the users bulk folder but not to the user inbox.i dont know the 
reason.

Is there any setting that is requried in the php.ini file (or) the user have 
to change their setting in their mail (or) is there any option available to 
send mail to the user inbox.tnxs for reply

A.suresh




-
Find out what India is talking about on - Yahoo! Answers India 
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW
 
 
 There are several things you need to check for, and probably add to your
 emails that you're sending.
 
 Number one, add additional headers to make SPAM / Bulk filters realize
 the message is not SPAM or should not be considered SPAM. IE:
 
 $headers = From: Suresh Kumar \r\n.
 X-Mailer: PHP 4.3.2\r\n.
 X-Sender: $_SERVER['HTTP_HOST']\r\n.
 X-Comment: If you can put a comment here, do it.\r\n;
 
 mail($to, $subject, $body, $headers);
 
 The above is considering you have already declared the $to, $subject,
 and $body variables. Also, make sure your $subject is not
 'undisclosed-recipients;' or something like that - it's a big no-no and
 will definitely flag some SPAM filters. Put a valid e-mail address - but
 you can still use the BCC-headers and everything should go just fine.
 Alternatively, if your list is not too large, it looks better to run a
 for / while loop to send each recipient a message directly (ie: not
 using BCC) as that will cut down on the SPAM probability.
 
 Second, if you are making MIME emails, make sure you are doing so
 correctly. You can learn about creating multipart/alternative MIME
 emails more at www.php.net/mail.
 
 Finally, if none of the above works, it would be helpful for us to see
 the headers of the received message from one of your recipients where
 the message was put in the BULK folder.
 
 - --
 Christopher Weldon, ZCE
 President  CEO
 Cerberus Interactive, Inc.
 [EMAIL PROTECTED]
 979.739.5874
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.1 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iD8DBQFFBaG2Zxvk7JEXkbERAgZiAKCJVQfno2fAca13Sx7aXPWD2WMgUwCeOMBX
 grbViYDnAXXy8l1i4liVHzE=
 =ka5I
 -END PGP SIGNATURE-
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mail() help

2006-09-12 Thread Peter Lauri
What are you doing on this line:

$headers .= 'From: MyADTV asureshkumar_1983'@yahoo.co.in' . \r\n;

Should it not be:

$headers .= 'From: MyADTV [EMAIL PROTECTED]' . \r\n;

?

/Peter

www.lauri.se - personal web site
www.dwsasia.com - company web site



-Original Message-
From: suresh kumar [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 12, 2006 7:56 PM
To: php-general@lists.php.net
Subject: [PHP] mail() help

Hi,
  I  am using php mail function to send mails to our customers.but when
i send mail to them.it is getting received in customers bulk folder .i want
mail to get received in customers inbox.i dont know the reason why its
getting stored in bulk folder.
   
   i attached the code.below,any one help me

  $to='[EMAIL PROTECTED]';

$subject='Password from MyAdTV';

$headers  = 'MIME-Version: 1.0' . \r\n;

$headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;

$headers .= 'From: MyADTV asureshkumar_1983'@yahoo.co.in' .
\r\n;

$headers.= 'X-Mailer: PHP/' . phpversion(). \r\n;

$sendmessage = brHere is the information you
requestedbrbrYour Logon name and Password details for MyADTV
Accountbrbrb your LogonName is /b: suresh brbrb your Password
is /b rajaysbrbrIf You Want To Login into Your MyADTV Account,a
href=\Click'http://myadtv.com/login.php\;Click Here/abrbr;
  
   
 mail($to,$subject,$sendmessage,$headers);
  

Christopher Weldon [EMAIL PROTECTED] wrote:
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

suresh kumar wrote:
 Hi to all,
 i am having one doubt regarding php mail function.i am using php mail()
function to send mail to the users.but when i send mail throught php its
going to the users bulk folder but not to the user inbox.i dont know the
reason.
 
 Is there any setting that is requried in the php.ini file (or) the user
have to change their setting in their mail (or) is there any option
available to send mail to the user inbox.tnxs for reply
 
 A.suresh
 
 
 
 
 -
 Find out what India is talking about on - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get
it NOW

There are several things you need to check for, and probably add to your
emails that you're sending.

Number one, add additional headers to make SPAM / Bulk filters realize
the message is not SPAM or should not be considered SPAM. IE:

$headers = From: Suresh Kumar \r\n.
X-Mailer: PHP 4.3.2\r\n.
X-Sender: $_SERVER['HTTP_HOST']\r\n.
X-Comment: If you can put a comment here, do it.\r\n;

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

The above is considering you have already declared the $to, $subject,
and $body variables. Also, make sure your $subject is not
'undisclosed-recipients;' or something like that - it's a big no-no and
will definitely flag some SPAM filters. Put a valid e-mail address - but
you can still use the BCC-headers and everything should go just fine.
Alternatively, if your list is not too large, it looks better to run a
for / while loop to send each recipient a message directly (ie: not
using BCC) as that will cut down on the SPAM probability.

Second, if you are making MIME emails, make sure you are doing so
correctly. You can learn about creating multipart/alternative MIME
emails more at www.php.net/mail.

Finally, if none of the above works, it would be helpful for us to see
the headers of the received message from one of your recipients where
the message was put in the BULK folder.

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBaG2Zxvk7JEXkbERAgZiAKCJVQfno2fAca13Sx7aXPWD2WMgUwCeOMBX
grbViYDnAXXy8l1i4liVHzE=
=ka5I
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-
 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get
it NOW

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() help

2006-09-12 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

suresh kumar wrote:
 Hi,
   I  am using php mail function to send mails to our customers.but when i 
 send mail to them.it is getting received in customers bulk folder .i want 
 mail to get received in customers inbox.i dont know the reason why its 
 getting stored in bulk folder.

i attached the code.below,any one help me
 
   $to='[EMAIL PROTECTED]';
 
 $subject='Password from MyAdTV';
 
 $headers  = 'MIME-Version: 1.0' . \r\n;
 
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
 
 $headers .= 'From: MyADTV asureshkumar_1983'@yahoo.co.in' . 
 \r\n;
 
 $headers.= 'X-Mailer: PHP/' . phpversion(). \r\n;
 
 $sendmessage = brHere is the information you requestedbrbrYour 
 Logon name and Password details for MyADTV Accountbrbrb your LogonName 
 is /b: suresh brbrb your Password is /b rajaysbrbrIf You Want 
 To Login into Your MyADTV Account,a 
 href=\Click'http://myadtv.com/login.php\;Click Here/abrbr;
   

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

Yes, you definitely have a problem with the From line, but I also
suggest that you turn your email into a multipart message - IE have a
plaintext version of your email as well as an HTML version of the email.
This not only will probably be less of a sign of SPAM because it won't
contain mostly HTML. I know SPAMAssassin has a rule that scores big SPAM
points for messages that are  90% HTML.

Finally, after you fix all of those issues, if you still have a problem
with your messages being flagged as SPAM, send us the full email (with
all the headers) so we can see the reason behind the message being
marked as SPAM.

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBx4pZxvk7JEXkbERAg6IAJ4pMh1DMNP+TrPIh+j7UHz51dSkqgCfUhzC
yiG9jiZDyjxPAjunLgOhiGo=
=z8H3
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() help

2006-09-11 Thread suresh kumar
Hi to all,
  i am having one doubt regarding php mail function.i am using php 
mail() function to send mail to the users.but when i send mail throught php its 
going to the users bulk folder but not to the  user inbox.i dont know the 
reason.
   
   Is there any setting that is requried in the php.ini file (or) the 
user have to change their setting in their mail (or) is there any option 
available to send mail to the user inbox.tnxs for reply
   
 A.suresh
   
  


-
 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW

Re: [PHP] mail() help

2006-09-11 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

suresh kumar wrote:
 Hi to all,
   i am having one doubt regarding php mail function.i am using 
 php mail() function to send mail to the users.but when i send mail throught 
 php its going to the users bulk folder but not to the  user inbox.i dont know 
 the reason.

Is there any setting that is requried in the php.ini file (or) the 
 user have to change their setting in their mail (or) is there any option 
 available to send mail to the user inbox.tnxs for reply

  A.suresh

   
 
   
 -
  Find out what India is talking about on  - Yahoo! Answers India 
  Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get 
 it NOW

There are several things you need to check for, and probably add to your
emails that you're sending.

Number one, add additional headers to make SPAM / Bulk filters realize
the message is not SPAM or should not be considered SPAM. IE:

$headers =  From: Suresh Kumar [EMAIL PROTECTED]\r\n.
X-Mailer: PHP 4.3.2\r\n.
X-Sender: $_SERVER['HTTP_HOST']\r\n.
X-Comment: If you can put a comment here, do it.\r\n;

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

The above is considering you have already declared the $to, $subject,
and $body variables. Also, make sure your $subject is not
'undisclosed-recipients;' or something like that - it's a big no-no and
will definitely flag some SPAM filters. Put a valid e-mail address - but
you can still use the BCC-headers and everything should go just fine.
Alternatively, if your list is not too large, it looks better to run a
for / while loop to send each recipient a message directly (ie: not
using BCC) as that will cut down on the SPAM probability.

Second, if you are making MIME emails, make sure you are doing so
correctly. You can learn about creating multipart/alternative MIME
emails more at www.php.net/mail.

Finally, if none of the above works, it would be helpful for us to see
the headers of the received message from one of your recipients where
the message was put in the BULK folder.

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBaG2Zxvk7JEXkbERAgZiAKCJVQfno2fAca13Sx7aXPWD2WMgUwCeOMBX
grbViYDnAXXy8l1i4liVHzE=
=ka5I
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail reply-path

2006-08-16 Thread bob pilly
Hi Richard this is exactly what i was after and works perfectly! 

Cheers

Bob

Richard Lynch [EMAIL PROTECTED] wrote: On Tue, August 15, 2006 6:54 am, bob 
pilly wrote:
 Im trying to send emails using the mail() function but im having a
 problem. Because the box that the scripts sit on is a shared
 web-hosting package the Reply-path part of the header always comes up
 as [EMAIL PROTECTED] but i have set the from part of the
 header to [EMAIL PROTECTED] A lot of people are not getting the
 emails (most are) and im picking that its because the domains on the 2
 header parts are different and they have some sort of antispam policy
 which blocks these. Apart from changing the domains or email addresses
 to be the same has anyone seen this problem before and if so can you
 give advice or point me to some relevant docs on it? I have tried to
 change the Replay-path: part of the header with code but it seems to
 default to the above.

The Reply-path: you want to change is not a normal header, so you can
cross off the idea of fixing it with the 4th arg to mail().

If you are using current PHP, there is yet another bonus argument, the
5th one, for this specific purpose, documented in the manual:
http://php.net/mail

If you are NOT using a version of PHP that has that 5th arg, then you
could maybe use ini_set on the sendmail_path to add the -f there. (see
man mail).

That, however, would require that the user PHP runs as, which is what
Apache runs as, be a trusted user in sendmail.cf, which your webhost
may or may not have decided is a Good Idea, based on how much they
trust their clients.

Going farther afield, you could attempt to find an SMTP
host/server/setup that would allow you to set these values to what you
want -- I *think* that's do-able...  I never had to go that far,
personally, so can't be certain.

You may also want to convince the recipients to white-list your
address, so that the From/Reply-path/etc are all irrelevant for spam
filtering.  This has the advantage of being a long-term solution, for
any reasonable implementation of spam-filtering that allows
whitelisting by the recipient, no matter what spam-filtering rules
are brought to bear in the future.

-- 
Like Music?
http://l-i-e.com/artists.htm





-
 All new Yahoo! Mail The new Interface is stunning in its simplicity and ease 
of use. - PC Magazine

[PHP] Mail reply-path

2006-08-15 Thread bob pilly
Hi all

Im trying to send emails using the mail() function but im having a problem. 
Because the box that the scripts sit on is a shared web-hosting package the 
Reply-path part of the header always comes up as [EMAIL PROTECTED] but i have 
set the from part of the header to [EMAIL PROTECTED] A lot of people are not 
getting the emails (most are) and im picking that its because the domains on 
the 2 header parts are different and they have some sort of antispam policy 
which blocks these. Apart from changing the domains or email addresses to be 
the same has anyone seen this problem before and if so can you give advice or 
point me to some relevant docs on it? I have tried to change the Replay-path: 
part of the header with code but it seems to default to the above.

Thanks in advance for any help!!

Cheers

Bob


-
 Try the all-new Yahoo! Mail . The New Version is radically easier to use – 
The Wall Street Journal

Re: [PHP] Mail reply-path

2006-08-15 Thread Jon Anderson

bob pilly wrote:

Im trying to send emails using the mail() function but im having a problem. 
Because the box that the scripts sit on is a shared web-hosting package the 
Reply-path part of the header always comes up as [EMAIL PROTECTED] but i have 
set the from part of the header to [EMAIL PROTECTED] A lot of people are not 
getting the emails (most are) and im picking that its because the domains on 
the 2 header parts are different and they have some sort of antispam policy 
which blocks these. Apart from changing the domains or email addresses to be 
the same has anyone seen this problem before and if so can you give advice or 
point me to some relevant docs on it? I have tried to change the Replay-path: 
part of the header with code but it seems to default to the above.
I think you're looking for the 'Return-Path' header rather than the 
reply-path. (Or perhaps even Reply-To?)


Try something like this:

$from = 'A User [EMAIL PROTECTED]';
$eol = \r\n; /* or sometimes \n */
$headers  = Return-Path: $from$eol;
$headers .= From: $from$eol;

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail reply-path

2006-08-15 Thread Richard Lynch
On Tue, August 15, 2006 6:54 am, bob pilly wrote:
 Im trying to send emails using the mail() function but im having a
 problem. Because the box that the scripts sit on is a shared
 web-hosting package the Reply-path part of the header always comes up
 as [EMAIL PROTECTED] but i have set the from part of the
 header to [EMAIL PROTECTED] A lot of people are not getting the
 emails (most are) and im picking that its because the domains on the 2
 header parts are different and they have some sort of antispam policy
 which blocks these. Apart from changing the domains or email addresses
 to be the same has anyone seen this problem before and if so can you
 give advice or point me to some relevant docs on it? I have tried to
 change the Replay-path: part of the header with code but it seems to
 default to the above.

The Reply-path: you want to change is not a normal header, so you can
cross off the idea of fixing it with the 4th arg to mail().

If you are using current PHP, there is yet another bonus argument, the
5th one, for this specific purpose, documented in the manual:
http://php.net/mail

If you are NOT using a version of PHP that has that 5th arg, then you
could maybe use ini_set on the sendmail_path to add the -f there. (see
man mail).

That, however, would require that the user PHP runs as, which is what
Apache runs as, be a trusted user in sendmail.cf, which your webhost
may or may not have decided is a Good Idea, based on how much they
trust their clients.

Going farther afield, you could attempt to find an SMTP
host/server/setup that would allow you to set these values to what you
want -- I *think* that's do-able...  I never had to go that far,
personally, so can't be certain.

You may also want to convince the recipients to white-list your
address, so that the From/Reply-path/etc are all irrelevant for spam
filtering.  This has the advantage of being a long-term solution, for
any reasonable implementation of spam-filtering that allows
whitelisting by the recipient, no matter what spam-filtering rules
are brought to bear in the future.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail reply-path

2006-08-15 Thread tedd

At 11:06 AM -0400 8/15/06, Jon Anderson wrote:

bob pilly wrote:
Im trying to send emails using the mail() function but im having a 
problem. Because the box that the scripts sit on is a shared 
web-hosting package the Reply-path part of the header always comes 
up as [EMAIL PROTECTED] but i have set the from part of the 
header to [EMAIL PROTECTED] A lot of people are not getting 
the emails (most are) and im picking that its because the domains 
on the 2 header parts are different and they have some sort of 
antispam policy which blocks these. Apart from changing the domains 
or email addresses to be the same has anyone seen this problem 
before and if so can you give advice or point me to some relevant 
docs on it? I have tried to change the Replay-path: part of the 
header with code but it seems to default to the above.
I think you're looking for the 'Return-Path' header rather than the 
reply-path. (Or perhaps even Reply-To?)




This works for me (use your own name and domain):  :-)

$to = [EMAIL PROTECTED];
$re = Subject;
$msg = Message\n;
$headers = Return-path: [EMAIL PROTECTED]\r\n;
$headers .= From: tedd [EMAIL PROTECTED]\r\n;
$param5 = '-ftedd@' . $_SERVER['SERVER_NAME'];
mail ($to, $re, $msg, $headers, $param5);

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail reply-path

2006-08-15 Thread Chris

Richard Lynch wrote:

On Tue, August 15, 2006 6:54 am, bob pilly wrote:

Im trying to send emails using the mail() function but im having a
problem. Because the box that the scripts sit on is a shared
web-hosting package the Reply-path part of the header always comes up
as [EMAIL PROTECTED] but i have set the from part of the
header to [EMAIL PROTECTED] A lot of people are not getting the
emails (most are) and im picking that its because the domains on the 2
header parts are different and they have some sort of antispam policy
which blocks these. Apart from changing the domains or email addresses
to be the same has anyone seen this problem before and if so can you
give advice or point me to some relevant docs on it? I have tried to
change the Replay-path: part of the header with code but it seems to
default to the above.


The Reply-path: you want to change is not a normal header, so you can
cross off the idea of fixing it with the 4th arg to mail().

If you are using current PHP, there is yet another bonus argument, the
5th one, for this specific purpose, documented in the manual:
http://php.net/mail

If you are NOT using a version of PHP that has that 5th arg, then you
could maybe use ini_set on the sendmail_path to add the -f there. (see
man mail).

That, however, would require that the user PHP runs as, which is what
Apache runs as, be a trusted user in sendmail.cf, which your webhost
may or may not have decided is a Good Idea, based on how much they
trust their clients.


and also safe_mode being off. Not sure why safe_mode affects this (ask 
the powers that be) but it does.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail headers

2006-08-04 Thread Richard Lynch
On Tue, July 25, 2006 11:47 pm, Chris wrote:
 There's a default for reply-to in the php.ini? What's the variable
 called - I can't see one. I can see these:

 ; For Win32 only.
 sendmail_from = [EMAIL PROTECTED]

 ; For Unix only.  You may supply arguments as well (default: 'sendmail
 -t -i').
 ;sendmail_path =

 but they have nothing to do with the reply-to address.

I think you would want something like:

sendmail_path = /usr/bin/sendmail -froot -t -i

The -froot sets the 'from' as documented in man sendmail.

But that's only supposed to be for trusted users, and it's unlikely
that you configured sendmail for the PHP/Apache user to be trusted...

But this is the Right Path to follow for this issue, I think.

Have fun reading sendmail docs. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail headers

2006-07-25 Thread Schalk

Greetings Everyone,

What in the piece of code below might be causing the headers for from 
and reply-to to be set incorrectly?


'
$headers = MIME-Version: 1.0\r\n.
Content-type: text/html; charset=iso-8859-1\r\n.
From: .$email.\r\n.
Reply-to: .$email.\r\n.
Date: .date(r).\r\n;
'

Using Thunderbird on XP it does set the from correctly but then uses the 
default from address set in php.ini for the reply-to. Any ideas? Thanks!


--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail headers

2006-07-25 Thread Chris

Schalk wrote:

Greetings Everyone,

What in the piece of code below might be causing the headers for from 
and reply-to to be set incorrectly?


'
$headers = MIME-Version: 1.0\r\n.
Content-type: text/html; charset=iso-8859-1\r\n.
From: .$email.\r\n.
Reply-to: .$email.\r\n.
Date: .date(r).\r\n;
'

Using Thunderbird on XP it does set the from correctly but then uses the 
default from address set in php.ini for the reply-to. Any ideas? Thanks!




There's a default for reply-to in the php.ini? What's the variable 
called - I can't see one. I can see these:


[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = [EMAIL PROTECTED]

; For Unix only.  You may supply arguments as well (default: 'sendmail 
-t -i').

;sendmail_path =


but they have nothing to do with the reply-to address.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() returns false but e-mail is sent ?

2006-06-26 Thread Leonidas Safran
Hello,

 Show us the full context of the code. The example you give us will work fine 
 but that doesn't tell us what's really going on in your code.

Here is the function I use to allow french special characters in the subject 
line (copied from german university tutorial 
http://www-cgi.uni-regensburg.de/~mim09509/PHP/list.phtml//www-cgi/home/mim09509/public_html/PHP/mail-quote.phtml?datei=%2Fwww-cgi%2Fhome%2Fmim09509%2Fpublic_html%2FPHP%2Fmail-quote.phtml%2Crfc822-syntax.txt):

function quote_printable($text, $max=75){
/* $text ist ein String (mit neue Zeilen drin), $max ist die max. Zielenlaenge
Ergebnis ist auch ein String, der nach rfc1521 als Content-Transfer-Encoding: 
quoted-printable verschluesselt ist.*/

 $t = explode(\n, ($text=str_replace(\r, , $text)));
 for ($i = 0; $i  sizeof($t); $i++){
  $t1 = ;
  for ($j = 0; $j  strlen($t[$i]); $j++){
   $c = ord($t[$i][$j]);
   if ( $c  0x20 || $c  0x7e || $c == ord(=))
$t1 .= sprintf(=%02X, $c);
   else $t1 .= chr($c);
  }
  while (strlen($t1)  $max+ 1){
   $tt[] = substr($t1, 0, $max).=;
   $t1 = substr($t1, $max);
  }
  $tt[] = $t1;
 }
 return join(\r\n, $tt);
}

function qp_header($text){
 $quote = quote_printable($text, 255);
 if ($quote != $text)
  $quote = str_replace( , _,=?ISO-8859-1?Q? . $quote . ?=);
 return $quote;
}

So, before I enter:

$sent = mail($destination, $subject, $content, $headers); 

I have:
$subject = qp_header($subject);

That's all... As said before, the e-mail is sent, but the mail() function 
returns false !


Thank you for your help

LS
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*!
Feel free mit GMX DSL! http://www.gmx.net/de/go/dsl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() returns false but e-mail is sent ?

2006-06-26 Thread Adam Zey

Leonidas Safran wrote:

Hello,


Show us the full context of the code. The example you give us will work fine 
but that doesn't tell us what's really going on in your code.


Here is the function I use to allow french special characters in the subject 
line (copied from german university tutorial 
http://www-cgi.uni-regensburg.de/~mim09509/PHP/list.phtml//www-cgi/home/mim09509/public_html/PHP/mail-quote.phtml?datei=%2Fwww-cgi%2Fhome%2Fmim09509%2Fpublic_html%2FPHP%2Fmail-quote.phtml%2Crfc822-syntax.txt):

function quote_printable($text, $max=75){
/* $text ist ein String (mit neue Zeilen drin), $max ist die max. Zielenlaenge
Ergebnis ist auch ein String, der nach rfc1521 als Content-Transfer-Encoding: 
quoted-printable verschluesselt ist.*/

 $t = explode(\n, ($text=str_replace(\r, , $text)));
 for ($i = 0; $i  sizeof($t); $i++){
  $t1 = ;
  for ($j = 0; $j  strlen($t[$i]); $j++){
   $c = ord($t[$i][$j]);
   if ( $c  0x20 || $c  0x7e || $c == ord(=))
$t1 .= sprintf(=%02X, $c);
   else $t1 .= chr($c);
  }
  while (strlen($t1)  $max+ 1){
   $tt[] = substr($t1, 0, $max).=;
   $t1 = substr($t1, $max);
  }
  $tt[] = $t1;
 }
 return join(\r\n, $tt);
}

function qp_header($text){
 $quote = quote_printable($text, 255);
 if ($quote != $text)
  $quote = str_replace( , _,=?ISO-8859-1?Q? . $quote . ?=);
 return $quote;
}

So, before I enter:

$sent = mail($destination, $subject, $content, $headers); 


I have:
$subject = qp_header($subject);

That's all... As said before, the e-mail is sent, but the mail() function 
returns false !


Thank you for your help

LS


And what code is checking the return value of mail()? Trust me, we've 
all made stupid mistakes, they're nasty little buggers that can sneak in 
and ruin anyone's day; best to include it since it might be relevant.


Regards, Adam.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() returns false but e-mail is sent ?

2006-06-25 Thread Leonidas Safran
Hello,

I'm wondering about the behavior of the mail() function.

$sent = mail($destination, $subject, $content, $headers);

I use some optional header parameters:
From:[EMAIL PROTECTED]: 1.0\r\nContent-Type: text/plain; 
charset=ISO-8859-1\r\nContent-Transfer-Encoding: quoted-printable\r\n.

Can that be source of error? I can see no error in the apache error_log.

I have special caracters in the subject line, which are converted first on php 
side to comply with standard. Here also, no error on apache error_log.

The result of mail() is false but the e-mail is sent! Returning true, but 
e-mail doesn't reach destination can make sense; in this case, it's strange, 
isn't it?

I'm using PHP v. 5.04 on a Linux Fedora Core 4 distri with Postfix 2.2.2.

I'd be glad if somebody could explain me what to do in order to get correct 
response when e-mail is passed to MTA...


Thanks,
LS
-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() returns false but e-mail is sent ?

2006-06-25 Thread Chris

Leonidas Safran wrote:

Hello,

I'm wondering about the behavior of the mail() function.

$sent = mail($destination, $subject, $content, $headers);

I use some optional header parameters:
From:[EMAIL PROTECTED]: 1.0\r\nContent-Type: text/plain; 
charset=ISO-8859-1\r\nContent-Transfer-Encoding: quoted-printable\r\n.

Can that be source of error? I can see no error in the apache error_log.

I have special caracters in the subject line, which are converted first on php 
side to comply with standard. Here also, no error on apache error_log.

The result of mail() is false but the e-mail is sent! Returning true, but 
e-mail doesn't reach destination can make sense; in this case, it's strange, 
isn't it?


Show us the full context of the code. The example you give us will work 
fine but that doesn't tell us what's really going on in your code.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail in Spam Box

2006-06-18 Thread kartikay malhotra

Hi all!

I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
Spam box and not the Inbox :(

Am I missing a header, signature, certificate?

Thanks
KM


Re: [PHP] Mail in Spam Box

2006-06-18 Thread Rabin Vincent

On 6/18/06, kartikay malhotra [EMAIL PROTECTED] wrote:

I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
Spam box and not the Inbox :(

Am I missing a header, signature, certificate?


You're probably missing a header, but, who knows, you
haven't shown us any code.

Rabin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail in Spam Box

2006-06-18 Thread Travis Doherty
kartikay malhotra wrote:

 Hi all!

 I've use PHP mail to send mail to my Gmail ID. But it gets delivered
 to my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

 Thanks
 KM


Is the system you are sending from listed in any RBLs?  If you don't set
a subject line, SpamAssassin hits you hard, make sure you have a real
To:, From:, and Subject: header.  The date header also needs to be set -
with the correct time.

Spam scores come from many different sources of information - two major
sources are the message itself and the server sending the message.  If
you can send mail from this server using a normal mail client and it
does not get blocked as spam then it is probably your message.  If
sending using a normal client still gets blocked as spam in you gmail
account chances are it is the server and not your code.

Travis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function dying half way through. [SOLVED]

2006-06-11 Thread Dave M G

Chris, Richard,

Thank you for your advice.

Inserting sleep(1) into the script seems to have done the trick.

I will also look into the other alternatives you suggest, such as 
different mail programs and the error output of mail() to see if I can 
optimize the system further.


Thank you for taking the time to help.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail sending program (beginner)

2006-06-11 Thread aci india

Since it was sunday I was not able to thank instently. Thanks for the help.
Thanks to all.
[snipped...]


Re: [PHP] Mail sending program (beginner)

2006-06-10 Thread Rabin Vincent

On 6/10/06, aci india [EMAIL PROTECTED] wrote:

NOTE: Sorry for the very long code


Please paste long code snippets in a website like
pastebin.com. Also, the code is hard to read because
of the complete lack of indentation.

I suggest you atleast attempt to debug your code before
posting it here. Sprinkle echo or var_dump statements
throughout your code and try to find out where the problem
is. Make liberal use of the documentation at php.net/manual.

I have placed some comments inline, and pointed
out your infinite loop.


the mail.php file:

^^^

?php

/*mail body file*/

function cnd($fname)

{

$fil = fopen($fname,r);

if(!$fil)

die(fopen error);

while(!feof($fil))

$buffer = fgets($fil);

while($buffer != NULL)

{

if($buffer == \n.) /*a line should not start with .*/


What is this? You are checking if the whole string is
equal to \n., which I think will never happen.

You probably want $buffer{0} == '.'/


$buffer = str_replace(\n.,\n.., $buffer);


As above.


if($buffer == \n  $buffer  70) /*should be less than 70*/


What is this supposed to be? You are checking if
the line is empty, and then checking if it is greater
than 70? And you probably mean strlen in the second
part of the if.


$buffer = '\n';

}

fclose($fil);

return $buffer;

}

/*mail sub file*/

function sub($fname)

{

$fil = fopen($fname,r);

if(!$fil)

die(fopen err in sub file);

while(!feof($fil))

$buff = fgets($fil);

while($buff != NULL)

{

if($buff  15)


strlen here too. Strings don't magically give out their
length.


{

?

script language=javascript

alert(the subject line should not be less than 15, pls check the sub.txtfile);

/script
?php

}

}

fclose($fil);

return $buff;

}

function fetch_names()

{

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$result = mysql_query(select name from users,$var) or die(unable to fetch
rows);

$rows = mysql_fetch_array($result);

while($rows)

{


Here's your infinite loop. Review the docs on how to
iterate through returned rows. php.net/mysql_query.



for($i=0; $i= $rows ; $i++)

for($j=0;$j = i-1 ; $j++)

$names[$i] = $rows[$j];

}

return $names;

}

function fetch_emails()

{

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$result = mysql_query(select email from users,$var) or die(unable to
fetch rows);

$rows = mysql_fetch_array($result);

while($rows)

{


One more infinite loop.



for($i=0; $i= $rows ; $i++)

for($j=0;$j = i-1 ; $j++)

$email[$i] = $rows[$j];

}

return $email;

}

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$name = $_POST['user_name'];

$mail = $_POST['user_email'];

$db_q = mysql_query(insert into users values('$name','$mail'));


This is open to SQL injection attacts. See
php.net/mysql_real_escape_string and phpsec.org


if(!$db_q)

die(mysql error);

$condt = cnd(cond.txt);

$sub = sub (sub.txt);

$name = fetch_names();

$email = fetch_emails();

$mail_stat = mail($email,$sub,$condt,from:[EMAIL PROTECTED]);

if($mail_stat == NULL)


mail doesn't return NULL. php.net/mail.


echo mail sent failed;

else

echo mail sent sucess. Pls check for mail for further acction;

?
==code ends


Rabin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail sending program (beginner)

2006-06-10 Thread benifactor
i don't really understand what your trying to do here but if im correct
there is a much easier way...

if you are trying to make a newletter sign up this is simple. there is no
reason to send the email to the database simply have the enter thier email
address, use regex to check it, if it passes that test, send it and a uniqe
conformation number to a database, and use mail() to send them the
conformation information with the link to the confirm page.  they then click
on the link to confirm.php or whatever and it will check the database for
that email or number... if they are both there and the both match it will
erase it from the confirm database and send the info to the newsletter
database. i will give you an example...

//start index.php or news_signup.php or something of the sort...
?php
//first we define the function for the email check...

 function is_valid ($email) {

  if
(eregi(^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL 
PROTECTED](\.[a-z0-9-]+)*(\.[a-z]{2,3})
$, $email)) {

  return true;

  }
 }
//check to see if the signup form button was pressed and perform tests on
the form data..

 if ($HTTP_POST_VARS[ADD_USER]) {
  if (!$HTTP_POST_VARS[email]) {
   $e = error! you must enter your email address!;
  }
  else {
  if (!is_valid($HTTP_POST_VARS[email]) {
   $e = error! your email address is invalid!;
  }
  else {
   //all the tests passed at this point, so we make that conf # i talked
about...
   $conf = uniqid(nuser);
   //now we eneter all the information in to a database called add that has
three feilds.. auto_increment id. email. confid.
   mysql_query(insert into add (id, email, confid) VALUES (null, '$email',
'$conf'));
   //now we send the email
   $to  = $email;
   $subject = 'Your Newsletter subscription...';
   $message = Hello $email, your registration is almost complete! all you
have to do now is confirm your registration. to do this simply click on this
link: a
href=\http://yoursite.com/newsletter/confirm.php?confid=$conf\;Complete
Registration Now/a or, copy and paste this into your web browser:
www.yoursite.com/newsletter/confirm.php?confid=$conf brbrbPlease Note:
your resgistration will expire in exactly 24 hours from when you clicked the
register button, so please confirm your registration now!/b;
   $message = wordwrap($message);
   $headers = 'From: [EMAIL PROTECTED]' . \r\n;
   $headers  .= 'MIME-Version: 1.0' . \r\n;
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
   mail($to, $subject, $message, $headers);
   $e = congratulations you have signed up! You should recieve an email
shortly to confirm.;

  }
  }
  }
  else {
  //now we actually display the form
?

form method=post action=whateveryoucallit.php
email:br
input type=text name=email value=?php echo($email); ?
length=35br
input type=submit name=ADD_USER value=SIGN UP!
/form

?php
//now we wnd the orginal php block
}

//now we dipslay the error message if there was any...

if ($e) {
echo($e);
}

?

this is the whole first page. simple. not too many languages. now the
confirm page.


//start confirm.php or whatever.

?php
//first we make sure they got to this page by email, making sure the
variable $conf is set
if (!$conf) {

 $e = (Sorry, you must have an id in order to complete the registration...
please click on or copy and paste the link from your email into your web
browser.. thank you - staff);
}
//now we make sure that the confid is in the database
else {
$cc1 = mysql_query(SELECT * from add where confid = '$conf') or
die(mysql_error());
$ccc1 = mysql_fetch_array($cc1);
if (!$ccc1) {
$e = (Sorry, The id you have enterd does not match any of our records...you
may have already confirmed your email - staff);
}
//grab the data where the ids match and enter the in to the new database
else {
$query = mysql_query(select * from conf where confid = '$conf');
while ($d = mysql_fetch_array($query)) {
$email = $d[email];
mysql_query(insert into users (id, email) VALUES (NULL, '$email')) or
die(mysql_error());
//delete from the conf database
mysql_query(delete from conf where conf = '$confid') or
die(mysql_error());
$s = (Congratulations b$email/b, you have successfully signedup... you
will now get our monthly emails...);
}
}
}
}
if ($e) {
echo(bcenter$e/b/center);
}
if ($s) {
echo(bcenter$s/b/centerbrbcenter$s1/b/centerbrcenter
bYou will now be redirected to login.../b/center);
}
?

this is not perfect, but should give you an idea of what your doing and a
different way (possibly better) of doing this.

- Original Message - 
From: aci india [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, June 09, 2006 10:24 PM
Subject: [PHP] Mail sending program (beginner)


 Dear group,

 Description:

 Following is the code which I tried for learning propuses. It is a mail
 sending program

 which checks weather the user enters a correct mail id If he enters the
 correct mail ID then

 user name and e-mail will get stored in the mysql data base table. After
 getting stored

 then mail will sent

Re: [PHP] Mail sending program (beginner)

2006-06-10 Thread tedd
At 10:54 AM +0530 6/10/06, aci india wrote:
Dear group,

Description:

Following is the code which I tried for learning propuses. It is a mail
sending program


-snip-

I read what you wanted, try this:

http://www.weberdev.com/get_example-503.html

hth's

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() function dying half way through.

2006-06-09 Thread Dave M G

PHP List,

I have a database of about 120 users. Each weak I send out a newsletter. 
So far as I know, it's been working fine for the last couple of years.


Then recently some users emailed me to let me know that they haven't 
been receiving all the messages. I added extra output to my script to 
echo out the name of each member that got an email sent to them, and I 
can now see that only about 50 of them are getting the email.


The only think that has changed that I can think of is that I've 
upgraded to MySQL 5.0. However, given the type of problem I'm having, I 
don't think it's a MySQL problem, it appears much more likely to be a 
problem with my PHP code.


This is the script that sends out the message (edited slightly to take 
out irrelevant bits of newsletter content):


- - - -
$count = 0;
while ( $member = mysql_fetch_row($result) )
{
set_time_limit(0);
$subject = Newsletter subject line;
$mailcontent = This message was sent to  . $member[0] .  at {$member[1]}
Blah, blah, blah - newsletter content goes here.;
mail($member[1], $subject, $mailcontent, $fromaddress);
$count++;
echo pNewsletter sent to  .  $member[0] .  at  . $member[1] . /p;
}
echo pA total of  .$count . emails were sent out./p\n;
- - - -

The script actually dies before it gets to the last echo which echoes 
the value of $count. It outputs about 50 lines of Newsletter sent to 
usersname at [EMAIL PROTECTED] and then the cursor is stuck in hourglass 
mode and the browser is continually waiting a response. It stays like 
that indefinitely, and the only way it stops is if I go to another page 
or shut down the browser.


I have heard that the mail() function does have limitations on how many 
emails it sends out. But I thought it took hundreds, somewhere between 
500 and a thousand, of individual emails before it would die. And I also 
thought the set_time_limit(0) function would alleviate the problem of 
timing out.


Where have I gone wrong with this?

Any advice would be greatly appreciated. Thank you for taking the time 
to read this.


--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function dying half way through.

2006-06-09 Thread Chris

Dave M G wrote:

PHP List,

I have a database of about 120 users. Each weak I send out a newsletter. 
So far as I know, it's been working fine for the last couple of years.


Then recently some users emailed me to let me know that they haven't 
been receiving all the messages. I added extra output to my script to 
echo out the name of each member that got an email sent to them, and I 
can now see that only about 50 of them are getting the email.


The only think that has changed that I can think of is that I've 
upgraded to MySQL 5.0. However, given the type of problem I'm having, I 
don't think it's a MySQL problem, it appears much more likely to be a 
problem with my PHP code.


This is the script that sends out the message (edited slightly to take 
out irrelevant bits of newsletter content):


- - - -
$count = 0;
while ( $member = mysql_fetch_row($result) )
{
set_time_limit(0);
$subject = Newsletter subject line;
$mailcontent = This message was sent to  . $member[0] .  at {$member[1]}
Blah, blah, blah - newsletter content goes here.;
mail($member[1], $subject, $mailcontent, $fromaddress);
$count++;
echo pNewsletter sent to  .  $member[0] .  at  . $member[1] . /p;
}
echo pA total of  .$count . emails were sent out./p\n;
- - - -

The script actually dies before it gets to the last echo which echoes 
the value of $count. It outputs about 50 lines of Newsletter sent to 
usersname at [EMAIL PROTECTED] and then the cursor is stuck in hourglass 
mode and the browser is continually waiting a response. It stays like 
that indefinitely, and the only way it stops is if I go to another page 
or shut down the browser.


I have heard that the mail() function does have limitations on how many 
emails it sends out. But I thought it took hundreds, somewhere between 
500 and a thousand, of individual emails before it would die. And I also 
thought the set_time_limit(0) function would alleviate the problem of 
timing out.


Ask your host if they have enabled email throttling. If you're sending 
out too quickly, they might be getting cut off by your host and you'll 
need to sleep() between each email being sent.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function dying half way through.

2006-06-09 Thread Richard Lynch
On Fri, June 9, 2006 12:59 am, Dave M G wrote:
 I have a database of about 120 users. Each weak I send out a
 newsletter.
 So far as I know, it's been working fine for the last couple of years.

 Then recently some users emailed me to let me know that they haven't
 been receiving all the messages. I added extra output to my script to
 echo out the name of each member that got an email sent to them, and I
 can now see that only about 50 of them are getting the email.

 The only think that has changed that I can think of is that I've
 upgraded to MySQL 5.0. However, given the type of problem I'm having,
 I
 don't think it's a MySQL problem, it appears much more likely to be a
 problem with my PHP code.

 This is the script that sends out the message (edited slightly to take
 out irrelevant bits of newsletter content):

 - - - -
 $count = 0;
 while ( $member = mysql_fetch_row($result) )
 {
 set_time_limit(0);
 $subject = Newsletter subject line;
 $mailcontent = This message was sent to  . $member[0] .  at
 {$member[1]}
 Blah, blah, blah - newsletter content goes here.;
 mail($member[1], $subject, $mailcontent, $fromaddress);

mail() returns a value to indicate if it failed/succeeded in queueing
up the email.

Check it.

Also, every call to mail() fires up a sendmail process.

This is expensive.

maybe sleep(1) in between calls

or consider switching to SMTP

or sending ONE email with a Bcc...  Though that has a slightly higher
probability of being labeled as spam.

 $count++;
 echo pNewsletter sent to  .  $member[0] .  at  . $member[1] .
 /p;
 }
 echo pA total of  .$count . emails were sent out./p\n;
 - - - -

 The script actually dies before it gets to the last echo which echoes
 the value of $count. It outputs about 50 lines of Newsletter sent to
 usersname at [EMAIL PROTECTED] and then the cursor is stuck in hourglass
 mode and the browser is continually waiting a response. It stays like
 that indefinitely, and the only way it stops is if I go to another
 page
 or shut down the browser.

 I have heard that the mail() function does have limitations on how
 many
 emails it sends out. But I thought it took hundreds, somewhere between
 500 and a thousand, of individual emails before it would die. And I
 also
 thought the set_time_limit(0) function would alleviate the problem of
 timing out.

 Where have I gone wrong with this?

 Any advice would be greatly appreciated. Thank you for taking the time
 to read this.

 --
 Dave M G

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail sending program (beginner)

2006-06-09 Thread aci india

Dear group,

Description:

Following is the code which I tried for learning propuses. It is a mail
sending program

which checks weather the user enters a correct mail id If he enters the
correct mail ID then

user name and e-mail will get stored in the mysql data base table. After
getting stored

then mail will sent to the user as a accknoledg process. For the propus of
mail subject

and mail body, I have created two external files.

The problem:

Filling the rows and col in the data base is no problem at all. The value
getting stored.

But after clicking the button for accknoledg the browser takes lot of time
in execution. I doubt

with either the file handling functions or infinit loop. Or Am I missing
somthing basic? Pls mention if you faced a similear situation with file
handling and infinit loop. Thanks.



NOTE: Sorry for the very long code

== the code=

The html file:



HTML

body

form method=post name=my_frm action=mail.php

TABLE align =center

tr

td

Name:

/td

td

input id=text name=user_name

/td

/tr

tr

td

E-mail:

/td

td

input id=text name=user_email

/td

/tr

/TABLE

table align = center

tr

td

input type=submit name=click_btn value=yes,I want my 'CMS' NewsLetter
NOW! align=middle onClick=validt()

/td

/tr

/table

table align=center

tr

td

a href=test.htmlfont size=2Or click here to see how you can learn
everything

br

you need to know about CMS without signing up for our free newsletter
/font

/a

/td

/tr

/table

script language=javascript

function validt()

{

var str= document.my_frm.user_email.value;

var name = document.my_frm.user_name.value;

if(str.indexOf(@) 0 || str.indexOf(.)  0)

{

my_error()

}

else

alert(thanks for entering valid e-mail);

}

function my_error()

{

alert(pls enter a correct e-mail ID);

document.my_frm.user_email.value =  ;

}

/script

/form







/body

/HTML

the mail.php file:

^^^

?php

/*mail body file*/

function cnd($fname)

{

$fil = fopen($fname,r);

if(!$fil)

die(fopen error);

while(!feof($fil))

$buffer = fgets($fil);

while($buffer != NULL)

{

if($buffer == \n.) /*a line should not start with .*/

$buffer = str_replace(\n.,\n.., $buffer);

if($buffer == \n  $buffer  70) /*should be less than 70*/

$buffer = '\n';

}

fclose($fil);

return $buffer;

}

/*mail sub file*/

function sub($fname)

{

$fil = fopen($fname,r);

if(!$fil)

die(fopen err in sub file);

while(!feof($fil))

$buff = fgets($fil);

while($buff != NULL)

{

if($buff  15)

{

?

script language=javascript

alert(the subject line should not be less than 15, pls check the sub.txtfile);

/script

?php

}

}

fclose($fil);

return $buff;

}

function fetch_names()

{

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$result = mysql_query(select name from users,$var) or die(unable to fetch
rows);

$rows = mysql_fetch_array($result);

while($rows)

{

for($i=0; $i= $rows ; $i++)

for($j=0;$j = i-1 ; $j++)

$names[$i] = $rows[$j];

}

return $names;

}

function fetch_emails()

{

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$result = mysql_query(select email from users,$var) or die(unable to
fetch rows);

$rows = mysql_fetch_array($result);

while($rows)

{

for($i=0; $i= $rows ; $i++)

for($j=0;$j = i-1 ; $j++)

$email[$i] = $rows[$j];

}

return $email;

}

$var = mysql_connect(localhost,root,);

if(!$var)

die(could not connect.mysql_error());

$db = mysql_select_db(sathya_clon,$var);

if(!$db)

die(could not find the data base.mysql_error());

$name = $_POST['user_name'];

$mail = $_POST['user_email'];

$db_q = mysql_query(insert into users values('$name','$mail'));

if(!$db_q)

die(mysql error);

$condt = cnd(cond.txt);

$sub = sub (sub.txt);

$name = fetch_names();

$email = fetch_emails();

$mail_stat = mail($email,$sub,$condt,from:[EMAIL PROTECTED]);

if($mail_stat == NULL)

echo mail sent failed;

else

echo mail sent sucess. Pls check for mail for further acction;

?
==code ends

sorry english is not my native language.


[PHP] mail function in 4.2.2

2006-06-01 Thread Aaron Todd
I am working with a server that has version 4.2.2 on it.  I know...I 
know...its old.  Its my ISPs server so I don't have too much control over 
it.

Anyway,  I am seeing a problem where when I use the mail function to send 
out an email only some of the messages get to the destination.  I wrote a 
simple test script that runs through a loop and is supposed to send out five 
emails.  Usually only one or two of the emails make it.  And on top of that 
its not always the first two that get sent.  Here is my test script.  I also 
have tried using the sleep command to give it 5 seconds between each email 
thinking maybe it was a time thing.

for($i=0;$i5;$i++){
echo $i.br;
mail([EMAIL PROTECTED],test_.$i, test_.$i);
sleep(5);
}

Is there something with this version of PHP that could be effecting the mail 
function.  I checked the change log and there has been some improvements to 
the mail function, but not much detail on why the changes were necessary. 
Just wondering if I have come across an old bug or something.

I've already asked my ISP to upgrade this server so if that's the solution 
its on its way to being fixed.  Is there anything else that could be wrong?

Thanks

Aaron 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail function in 4.2.2

2006-06-01 Thread chris smith

On 6/1/06, Aaron Todd [EMAIL PROTECTED] wrote:

I am working with a server that has version 4.2.2 on it.  I know...I
know...its old.  Its my ISPs server so I don't have too much control over
it.

Anyway,  I am seeing a problem where when I use the mail function to send
out an email only some of the messages get to the destination.  I wrote a
simple test script that runs through a loop and is supposed to send out five
emails.  Usually only one or two of the emails make it.  And on top of that
its not always the first two that get sent.  Here is my test script.  I also
have tried using the sleep command to give it 5 seconds between each email
thinking maybe it was a time thing.

for($i=0;$i5;$i++){
echo $i.br;
mail([EMAIL PROTECTED],test_.$i, test_.$i);
sleep(5);
}

Is there something with this version of PHP that could be effecting the mail
function.  I checked the change log and there has been some improvements to
the mail function, but not much detail on why the changes were necessary.
Just wondering if I have come across an old bug or something.

I've already asked my ISP to upgrade this server so if that's the solution
its on its way to being fixed.  Is there anything else that could be wrong?


Ask the isp if they have mail throttling set up - apart from that
you'll need to work with them to get this fixed. They can access the
mail logs..

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail function in 4.2.2

2006-06-01 Thread Aaron Todd
Thanks for the reply.  I'll ask the ISP about throtteling next time I talk 
with them.

I would also like to mention that I am also getting intermitent results when 
just sending a single email.  One if the web pages I am testing is a support 
request form.  When the form is submitted it sends an email to me so I can 
test that it is working.  But sometimes it never makes it.  In this case I 
wouldn't thing that throttleing would be the cause.  Sometimes when I start 
working on it at 8 in the morning and do a test run it never makes it.  In 
that case nothing has been sent through PHP for at least 8 hours.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail function in 4.2.2

2006-06-01 Thread Chris

Aaron Todd wrote:
Thanks for the reply.  I'll ask the ISP about throtteling next time I talk 
with them.


I would also like to mention that I am also getting intermitent results when 
just sending a single email.  One if the web pages I am testing is a support 
request form.  When the form is submitted it sends an email to me so I can 
test that it is working.  But sometimes it never makes it.  In this case I 
wouldn't thing that throttleing would be the cause.  Sometimes when I start 
working on it at 8 in the morning and do a test run it never makes it.  In 
that case nothing has been sent through PHP for at least 8 hours.


Save the contact form messages (use error_log or an equivalent) and see 
if there's anything consistent in the emails that make it through or the 
emails that don't make it (can you specify your own subject for example)..


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail and hotmail

2006-05-05 Thread Angelo Zanetti


Peter Lauri wrote:

I do set the headers now, but still the email is not delivered to Hotmail.
This is the headers that I set:

X-Sender: [EMAIL PROTECTED]
From: DWS Asia [EMAIL PROTECTED]
Date: Thu, 04 May 2006 22:04:23 +0700
Subject: What is this? 2


the subject of your email!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mail and hotmail

2006-05-05 Thread Peter Lauri
:) And that was my subject for the test mail I sent :) It was just a
coincidence.

What values can Importance have?

$headers  = X-Sender: .$this-myFrom. .$this-myFromEmail..$eol;
$headers .= From: .$this-myFrom. .$this-myFromEmail..$eol; 
$headers .= Date: .date(r).$eol; 
$headers .= Subject: .$this-mySubject.$eol; 
$headers .= Delivered-to: .$this-myTo. .$this-myToEmail..$eol; 
$headers .= MIME-Version: 1.0.$eol; 
$headers .= Reply-To: .$this-myFrom. .$this-myFromEmail..$eol; 
$headers .= Content-type: text/html; charset=utf-8.$eol; 
$headers .= X-Priority: 3.$eol; 
$headers .= Importance: 3.$eol; 
$headers .= Return-Path: .$this-myFrom. .$this-myFromEmail..$eol; 
$headers .= X-Mailer: PHP v.phpversion().$eol;

X-Sender: [EMAIL PROTECTED]
From: DWS Asia [EMAIL PROTECTED]
Date: Thu, 04 May 2006 22:04:23 +0700
Subject: What is this? 2
Delivered-to: Markus Karlsson [EMAIL PROTECTED]
MIME-Version: 1.0
Reply-To: DWS Asia [EMAIL PROTECTED]
Content-type: text/html; charset=utf-8
X-Priority: 3
Importance: 3
Return-Path: DWS Asia [EMAIL PROTECTED]
X-Mailer: PHP v4.3.11

Best regards,
Peter Lauri



-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 05, 2006 1:31 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail and hotmail


Peter Lauri wrote:
 I do set the headers now, but still the email is not delivered to Hotmail.
 This is the headers that I set:
 
 X-Sender: [EMAIL PROTECTED]
 From: DWS Asia [EMAIL PROTECTED]
 Date: Thu, 04 May 2006 22:04:23 +0700
 Subject: What is this? 2

the subject of your email!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail and hotmail

2006-05-04 Thread Peter Lauri
Best group member,

I am sending email to a hotmail thru PHP. When I send it like this it
arrives (in the junk mail, but it arrives):

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text');

It works well, but I want to change the FROM header so I do this:

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
Lauri [EMAIL PROTECTED]');

This email does not arrive to the Hotmail inbox.


If I send to a regular email, like Google Email (gmail) or a regular POP3 it
arrives without problems.

Anyone who has experienced this problem with sending emails to Hotmail? And
how do you solve it?

Best regards,
Peter Lauri

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail and hotmail

2006-05-04 Thread Paul Scott
On Thu, 2006-05-04 at 17:37 +0700, Peter Lauri wrote:

 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
 Lauri [EMAIL PROTECTED]');
 
 This email does not arrive to the Hotmail inbox.

This has been discussed ad nauseum on this list. I suggest going through
the list archives on proper ways to send through additional headers.

(or you could RTFM)

--Paul

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail and hotmail

2006-05-04 Thread Angelo Zanetti


Peter Lauri wrote:

Best group member,

I am sending email to a hotmail thru PHP. When I send it like this it
arrives (in the junk mail, but it arrives):

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text');

It works well, but I want to change the FROM header so I do this:

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
Lauri [EMAIL PROTECTED]');

This email does not arrive to the Hotmail inbox.


If I send to a regular email, like Google Email (gmail) or a regular POP3 it
arrives without problems.

Anyone who has experienced this problem with sending emails to Hotmail? And
how do you solve it?

Best regards,
Peter Lauri


 you need to set your mail headers for the mail to be assumed valid, namely:
X-Sender
From
Date
Subject
Delivered-to
MIME-Version
Reply-To
Content-type
X-Priority
Importance
Return-Path
X-Mailer

HTH
Angelo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mail and hotmail

2006-05-04 Thread Peter Lauri
Paul,

I did make a search on this. However, as you understand, searching for
hotmail mail header will generate to much junk because it will be replies
from hotmails that also will be included.

/Peter

-Original Message-
From: Paul Scott [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 04, 2006 5:43 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail and hotmail

On Thu, 2006-05-04 at 17:37 +0700, Peter Lauri wrote:

 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
 Lauri [EMAIL PROTECTED]');
 
 This email does not arrive to the Hotmail inbox.

This has been discussed ad nauseum on this list. I suggest going through
the list archives on proper ways to send through additional headers.

(or you could RTFM)

--Paul

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mail and hotmail

2006-05-04 Thread Paul Scott
On Thu, 2006-05-04 at 17:51 +0700, Peter Lauri wrote:
 Paul,
 
 I did make a search on this. However, as you understand, searching for
 hotmail mail header will generate to much junk because it will be replies
 from hotmails that also will be included.

Try the mail function on http://za2.php.net/ as well as a google for php
mail headers. Hotmail has very little to do with your question.

--Paul

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Mail and hotmail

2006-05-04 Thread Peter Lauri
The only one I do not know what to set it to is Importance. What values
are possible there? Is it the same as for X-priority?

Regards, 
Peter

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 04, 2006 5:53 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail and hotmail


Peter Lauri wrote:
 Best group member,
 
 I am sending email to a hotmail thru PHP. When I send it like this it
 arrives (in the junk mail, but it arrives):
 
 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text');
 
 It works well, but I want to change the FROM header so I do this:
 
 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
 Lauri [EMAIL PROTECTED]');
 
 This email does not arrive to the Hotmail inbox.
 
 
 If I send to a regular email, like Google Email (gmail) or a regular POP3
it
 arrives without problems.
 
 Anyone who has experienced this problem with sending emails to Hotmail?
And
 how do you solve it?
 
 Best regards,
 Peter Lauri
 
  you need to set your mail headers for the mail to be assumed valid,
namely:
X-Sender
From
Date
Subject
Delivered-to
MIME-Version
Reply-To
Content-type
X-Priority
Importance
Return-Path
X-Mailer

HTH
Angelo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail and hotmail

2006-05-04 Thread Christian Heinrich

Hi Peter,

RFC 2156 (http://www.faqs.org/rfcs/rfc2156.html) defines the importance 
header as following:


importance  = low / normal / high


Which means that you can either use the values low, normal or high

HTH,
Christian


The only one I do not know what to set it to is Importance. What values
are possible there? Is it the same as for X-priority?

Regards, 
Peter


-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 04, 2006 5:53 PM

To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail and hotmail


Peter Lauri wrote:
 


Best group member,

I am sending email to a hotmail thru PHP. When I send it like this it
arrives (in the junk mail, but it arrives):

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text');

It works well, but I want to change the FROM header so I do this:

mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
Lauri [EMAIL PROTECTED]');

This email does not arrive to the Hotmail inbox.


If I send to a regular email, like Google Email (gmail) or a regular POP3
   


it
 


arrives without problems.

Anyone who has experienced this problem with sending emails to Hotmail?
   


And
 


how do you solve it?

Best regards,
Peter Lauri

   


 you need to set your mail headers for the mail to be assumed valid,
namely:
X-Sender
From
Date
Subject
Delivered-to
MIME-Version
Reply-To
Content-type
X-Priority
Importance
Return-Path
X-Mailer

HTH
Angelo

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail and hotmail

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 5:37 am, Peter Lauri wrote:
 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From:
 Peter
 Lauri [EMAIL PROTECTED]');

I think you need 'From: Peter Lauri [EMAIL PROTECTED]' for starters.

 This email does not arrive to the Hotmail inbox.

There's spam, and then there's spam.

I suspect Hotmail just completely trashes some spam, and delivers
others to the User for their spam filtering.

It's a multi-layer complex system, almost-for-sure.

Not to mention that Hotmail is so unreliable, you can't even rely on
it to deliver mail at all, so I gave up worrying about it long ago.

In email receiving, you get what you pay for.

Except AOL, where you don't even get that much.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mail and hotmail

2006-05-04 Thread Peter Lauri
I do set the headers now, but still the email is not delivered to Hotmail.
This is the headers that I set:

X-Sender: [EMAIL PROTECTED]
From: DWS Asia [EMAIL PROTECTED]
Date: Thu, 04 May 2006 22:04:23 +0700
Subject: What is this? 2
Delivered-to: Markus Karlsson [EMAIL PROTECTED]
MIME-Version: 1.0
Reply-To: DWS Asia [EMAIL PROTECTED]
Content-type: text/html; charset=utf-8
X-Priority: 3
Importance: 3
Return-Path: DWS Asia [EMAIL PROTECTED]
X-Mailer: PHP v4.3.11

With this code:

$headers  = X-Sender: .$this-myFrom. .$this-myFromEmail..$eol;
$headers .= From: .$this-myFrom. .$this-myFromEmail..$eol;
$headers .= Date: .date(r).$eol;
$headers .= Subject: .$this-mySubject.$eol;
$headers .= Delivered-to: .$this-myTo. .$this-myToEmail..$eol;
$headers .= MIME-Version: 1.0.$eol;
$headers .= Reply-To: .$this-myFrom. .$this-myFromEmail..$eol;
$headers .= Content-type: text/html; charset=utf-8.$eol;
$headers .= X-Priority: 3.$eol;
$headers .= Importance: 3.$eol;
$headers .= Return-Path: .$this-myFrom. .$this-myFromEmail..$eol;
$headers .= X-Mailer: PHP v.phpversion().$eol;

ini_set('sendmail_from', $this-myFromEmail);
mail($this-myToEmail, $this-mySubject, $this-myHTML, $headers);
ini_restore('sendmail_from');

I tried with and without the ini_set.

Best regards,
Peter Lauri




-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 04, 2006 5:53 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail and hotmail


Peter Lauri wrote:
 Best group member,
 
 I am sending email to a hotmail thru PHP. When I send it like this it
 arrives (in the junk mail, but it arrives):
 
 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text');
 
 It works well, but I want to change the FROM header so I do this:
 
 mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter
 Lauri [EMAIL PROTECTED]');
 
 This email does not arrive to the Hotmail inbox.
 
 
 If I send to a regular email, like Google Email (gmail) or a regular POP3
it
 arrives without problems.
 
 Anyone who has experienced this problem with sending emails to Hotmail?
And
 how do you solve it?
 
 Best regards,
 Peter Lauri
 
  you need to set your mail headers for the mail to be assumed valid,
namely:
X-Sender
From
Date
Subject
Delivered-to
MIME-Version
Reply-To
Content-type
X-Priority
Importance
Return-Path
X-Mailer

HTH
Angelo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail problems with Outlook

2006-04-08 Thread Richard Lynch

Because you have created ta totally BOUGS MIME email.

You've rn rough-shod over the standards for html enhanced (cough,
cough) email.

Use plain-text, or do a ton of research or use the MIME email classes
from http://phpclasses.org


On Sat, April 8, 2006 5:52 pm, Schalk wrote:
 Greetings All,

 Is there any reason why the following code will correctly set the FROM
 and Reply-to fields in Thunderbird but not Outlook? Thanks!

 $firstName = $_POST['Contact_FirstName'];
 $lastName = $_POST['Contact_LastName'];
 $address = $_POST['Contact_Address'];
 $homePhone = $_POST['Contact_HomePhone'];
 $bestTime = $_POST['R1'];
 $email = $_POST['Contact_Email'];


 $to = '[EMAIL PROTECTED]';
 $subject = Request from www.helpmefindahome.info;
 $headers = MIME-Version: 1.0\r\n.
Content-type: text/html; charset=iso-8859-1\r\n.
From: .$email.\r\n.
Reply-to: .$email.\r\n.

Date: .date(r).\r\n;

 // Compose message:
 $message = 
 html
 body
 h1Message From: .$firstName.   .$lastName.
 /h1
 First Name: .$firstName.
 br /Last Name: .$lastName.
 br /Address: .$address.
 br /Home phone: .$homePhone.
 br /Best time to contact: .$bestTime.
 br /Email: .$email.
 /body
 /html
 ;

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

 --
 Kind Regards
 Schalk Neethling
 Web Developer.Designer.Programmer.President
 Volume4.Business.Solution.Developers

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() and exim

2006-04-07 Thread Webmaster

Hello,

I'm not sure if this is the right list to ask this on or not

Here's the situation... my php scripts were generating emails as 
expected.  I was shocked when they told me that exim was not responding 
to requests on port 25 and had to be restarted.  So, PHP communicates 
with exim internally and doesn't have the need for ports as far as PHP 
generated emails go?  Can anyone describe how this communication takes 
place between PHP and exim (or any mail server for that matter)??  Is 
this why exim would not send my emails via thunderbird but would send 
them via PHP???


Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail link problem with php echo statement

2006-03-23 Thread Richard Lynch




On Wed, March 22, 2006 10:29 pm, Mark wrote:

 How can i make this email from a database a hyperlink so it doesnt
 show the
 email address--i have tried many things but i keep getting errors. At
 the
 moment it just shows the email (no link)
 thanks



 ?php
 //get comp_id
 $query = mysql_query(SELECT * FROM comps WHERE name = '$comp_name');
 $result = mysql_fetch_array($query);

 $comp_id = $result['id'];
 $joinfee = $result['joinfee'];
 $email = $result['email'];

 ?

 Administrator email[?php echo $email;?]/td

echo a href=\mailto:$email\;whatever/a;


If you want to stop email harvesters, you can do:
$email = str_replace('@', '#64;', $email);
echo a href=\mailto:$email\;whatever/a;


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail link problem with php echo statement

2006-03-22 Thread Mark

How can i make this email from a database a hyperlink so it doesnt show the 
email address--i have tried many things but i keep getting errors. At the 
moment it just shows the email (no link)
thanks



?php
//get comp_id
$query = mysql_query(SELECT * FROM comps WHERE name = '$comp_name');
$result = mysql_fetch_array($query);

$comp_id = $result['id'];
$joinfee = $result['joinfee'];
$email = $result['email'];

?

Administrator email[?php echo $email;?]/td 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail link problem with php echo statement

2006-03-22 Thread Chris

Mark wrote:
How can i make this email from a database a hyperlink so it doesnt show the 
email address--i have tried many things but i keep getting errors. At the 
moment it just shows the email (no link)

thanks



?php
//get comp_id
$query = mysql_query(SELECT * FROM comps WHERE name = '$comp_name');
$result = mysql_fetch_array($query);

$comp_id = $result['id'];
$joinfee = $result['joinfee'];
$email = $result['email'];

?

Administrator email[?php echo $email;?]/td 



Something like this?

a href=mailto:?php echo $email; ?Email the administrator/a

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail function problems

2006-03-20 Thread Richard Lynch

On Windows, you need SMTP set.

If you can't set it in php.ini, you might try .htaccess, but I suspect
that is locked down and you can't...

You could try things like:

Install Pegasus email client, and use it from http://php.net/exec to
send email.

Install some kind of class from http://phpclasses.org that lets you
choose your own SMTP server, and the PHP code in that class handles
the mail protocol rather than using PHP's builtin code (which is tied
to php.ini settings)

Note that the built-in code will be faster but the mail() function
is never suitable for mass high-volume emails.

On Sun, March 19, 2006 3:50 pm, Paul Goepfert wrote:
 Hi all,

 Has anyone had this problem before?  I have a web server that resides
 on a windows platform (According to phpinfo()).  I used the php mail
 function to send out a test message to make sure that the mail
 function would work when needed.  I sent out the test message and I
 didn't get an email sent to me.  This is what I did, I created the
 following variables:

 $to = [EMAIL PROTECTED];
 $subject =Test;
 $message =This is a test
 $headers = From: Paul  .
   [EMAIL PROTECTED]\r\n;
 $headers .= X-Sender:  [EMAIL PROTECTED]\r\n;
 $headers .=X-Mailer: PHP\r\n;
 $headers .=Return-Path: [EMAIL PROTECTED]\r\n;

 I put them in the mail function as parameters
 mail($to,$subject,$message,$headers).


 Ok now this is what is found in phpinfo():

 sendmail_from no value no value
 sendmail_path no value no value
 SMTP no value no value
 smtp_port25   25

 Do these values need to be set?  if so, how do that on a remote
 server?  I don't think I have access to the httpd config file or
 php.ini file.

 Thanks
 Paul

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail function problems

2006-03-19 Thread Paul Goepfert
Hi all,

Has anyone had this problem before?  I have a web server that resides
on a windows platform (According to phpinfo()).  I used the php mail
function to send out a test message to make sure that the mail
function would work when needed.  I sent out the test message and I
didn't get an email sent to me.  This is what I did, I created the
following variables:

$to = [EMAIL PROTECTED];
$subject =Test;
$message =This is a test
$headers = From: Paul  .
  [EMAIL PROTECTED]\r\n;
$headers .= X-Sender:  [EMAIL PROTECTED]\r\n;
$headers .=X-Mailer: PHP\r\n;
$headers .=Return-Path: [EMAIL PROTECTED]\r\n;

I put them in the mail function as parameters
mail($to,$subject,$message,$headers).


Ok now this is what is found in phpinfo():

sendmail_from no value no value
sendmail_path no value no value
SMTP no value no value
smtp_port25   25

Do these values need to be set?  if so, how do that on a remote
server?  I don't think I have access to the httpd config file or
php.ini file.

Thanks
Paul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail function

2006-02-26 Thread Mohsen Pahlevanzadeh

Dear all,
I wanna mail to x user that x  can't see my IP address.
Do you know same function?
--Mohsen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail problem

2006-02-07 Thread Angelo Zanetti


Chris wrote:


check your SMTP settings in the PHP.ini file.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() and Return-Path header

2006-02-06 Thread Marcus Bointon

On 2 Feb 2006, at 13:00, Søren Schimkat wrote:

I'm using the mail function for sending mail, and I would like to  
specify the
Return-Path header, but it would seem that PHP or Apache is  
modyfying the

header.


Strictly speaking, you should not set a return-path header at all.  
You should set a 'sender' header, and the return-path header will be  
generated for you by your MTA. The reason for this is that a message  
may gain multiple return-path headers on its journey so that its full  
path can be traced backwards to the source. The common exception to  
this is if you're on Windows and don't have a local MTA (or on any  
platform and have PHPMailer's IsSMTP set), and your script is sending  
directly via SMTP and thus IS the MTA.


If you want to do proper bounce handling, you should also look into  
VERP addressing, as it's the only way to guarantee that you get  
tracable bounces - MS Exchange server sometimes bounces messages with  
no indication of the address the original message was sent to!


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail problem

2006-02-06 Thread PHP



Hi,
I upgraded to apache 2.2 and php5, now all my 
mail() functions return false.

But there is nothing in the logs as to why it 
failed.

sendmail is in the path.

Has something else changed that won't let mail() 
run?

Thanks.


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.2/252 - Release Date: 2/6/2006

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] mail problem

2006-02-06 Thread PHP



I also noticed there is no /usr/local/lib/php/Mail 
directory anymore, should there be with php5?

  - Original Message - 
  From: 
  PHP 
  
  To: php 
  Sent: Monday, February 06, 2006 10:35 
  AM
  Subject: [PHP] mail problem
  
  Hi,
  I upgraded to apache 2.2 and php5, now all my 
  mail() functions return false.
  
  But there is nothing in the logs as to why it 
  failed.
  
  sendmail is in the path.
  
  Has something else changed that won't let mail() 
  run?
  
  Thanks.
  
  
  
  

  No virus found in this outgoing message.Checked by AVG Free 
  Edition.Version: 7.1.375 / Virus Database: 267.15.2/252 - Release Date: 
  2/6/2006
  
  

  -- PHP General Mailing List (http://www.php.net/)To 
  unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.2/252 - Release Date: 2/6/2006

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] mail problem

2006-02-06 Thread Chris

Hi,

Is there a /usr/sbin/sendmail file on the server? php looks for this 
when it compiles, if it's not there then mail() won't work.


(check a phpinfo page as well and look for sendmail_path).

PHP wrote:
I also noticed there is no /usr/local/lib/php/Mail directory anymore, 
should there be with php5?


- Original Message -
*From:* PHP mailto:[EMAIL PROTECTED]
*To:* php mailto:php-general@lists.php.net
*Sent:* Monday, February 06, 2006 10:35 AM
*Subject:* [PHP] mail problem

Hi,
I upgraded to apache 2.2 and php5, now all my mail() functions
return false.
 
But there is nothing in the logs as to why it failed.
 
sendmail is in the path.
 
Has something else changed that won't let mail() run?
 
Thanks.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail() and Return-Path header

2006-02-02 Thread Søren Schimkat
Hi Guys

I'm using the mail function for sending mail, and I would like to specify the
Return-Path header, but it would seem that PHP or Apache is modyfying the
header.

This is the simple code:

mail('[EMAIL PROTECTED]', 'Subject', 'Message', From:
[EMAIL PROTECTED]: [EMAIL PROTECTED]);

.. but when the message bounces - it bounces to [EMAIL PROTECTED] instead of
the bounce adress?

Any hints on how to solve this problem?


-- 
Regards Søren Schimkat
www.schimkat.dk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() and Return-Path header

2006-02-02 Thread Richard Heyes

Søren Schimkat wrote:

Hi Guys

I'm using the mail function for sending mail, and I would like to specify the
Return-Path header, but it would seem that PHP or Apache is modyfying the
header.

This is the simple code:

mail('[EMAIL PROTECTED]', 'Subject', 'Message', From:
[EMAIL PROTECTED]: [EMAIL PROTECTED]);

.. but when the message bounces - it bounces to [EMAIL PROTECTED] instead of
the bounce adress?

Any hints on how to solve this problem?


If you're on *nix you can use the fifth parameter of the mail() 
function, and specify [EMAIL PROTECTED].


--
Richard Heyes
http://www.phpguru.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Solution [PHP] mail() and Return-Path header

2006-02-02 Thread Peppy
Thanks Richard.  That worked great.


- Original Message -
From: Richard Heyes [EMAIL PROTECTED]
To: Søren Schimkat [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, February 02, 2006 8:02 AM
Subject: Re: [PHP] mail() and Return-Path header


Søren Schimkat wrote:
 Hi Guys

 I'm using the mail function for sending mail, and I would like to specify
the
 Return-Path header, but it would seem that PHP or Apache is modyfying the
 header.

 This is the simple code:

 mail('[EMAIL PROTECTED]', 'Subject', 'Message', From:
 [EMAIL PROTECTED]: [EMAIL PROTECTED]);

 .. but when the message bounces - it bounces to [EMAIL PROTECTED] instead
of
 the bounce adress?

 Any hints on how to solve this problem?

If you're on *nix you can use the fifth parameter of the mail()
function, and specify [EMAIL PROTECTED].

--
Richard Heyes
http://www.phpguru.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail sending issues...

2006-02-02 Thread Richard Lynch
On Mon, January 30, 2006 8:51 pm, Richard Schilling wrote:
 I've been troubleshooting mail for a couple of days and searching
 every
 mail list archive/documentation/etc I could find.  Hoping someone can
 help me troubleshoot my mail sending problem.  I can't get the PHP
 mail
 function to send mail properly - even to addresses on the local host.

 I'm using Apache with PHP and sendmail.  I've verified the following:

 1. sendmail properly receives and sends e-mail
 2. aliases are setup properly and translated fine when receiving
 incoming e-mail from the Internet.


 Here's what happens (two problems):

 calling mail() with an aliased address from PHP causes sendmail to
 respond with the following error in /var/log/maillog:

   Jan 30 18:09:17 cognitiongroup sendmail[40125]: k0V29HhI040125:
 k0V29HhJ040125: DSN: User unknown

   As I mention above, when sending e-mail to the address in question
 via
 SMTP to the same sendmail server the mail is received fine.


 If I have mail() send e-mail to an un-aliased address, sendmail says
 the
 mail is delivered but it doesn't show up in the mail box.

Can you login as root and su to the PHP user (Apacher User in
httpd.conf) and then use mail on the command line to send mail to
the same addresses that PHP is sending to?

This probably most closely approximates what PHP is doing, and may
help uncover the issue.

I'd *GUESS* your sendmail.cf file is fargled somewhere...

Or perhaps the aliases db got corrupted in some subtle way?

Or...

Maybe for some reason the PHP user cannot read all the
files/directories it needs to be able to read for aliases to work, or
something like that, which does not appear when you run your tests as
other users.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail sending issues...

2006-01-30 Thread Richard Schilling
I've been troubleshooting mail for a couple of days and searching every 
mail list archive/documentation/etc I could find.  Hoping someone can 
help me troubleshoot my mail sending problem.  I can't get the PHP mail 
function to send mail properly - even to addresses on the local host.


I'm using Apache with PHP and sendmail.  I've verified the following:

1. sendmail properly receives and sends e-mail
2. aliases are setup properly and translated fine when receiving 
incoming e-mail from the Internet.



Here's what happens (two problems):

calling mail() with an aliased address from PHP causes sendmail to 
respond with the following error in /var/log/maillog:


	Jan 30 18:09:17 cognitiongroup sendmail[40125]: k0V29HhI040125: 
k0V29HhJ040125: DSN: User unknown


	As I mention above, when sending e-mail to the address in question via 
SMTP to the same sendmail server the mail is received fine.



If I have mail() send e-mail to an un-aliased address, sendmail says the 
mail is delivered but it doesn't show up in the mail box.



Thanks in advance!

Richard

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP mail form spam checking

2006-01-19 Thread Gerry Danen
A couple of days ago somebody posted a message with a routine to check
input fields for potential spam/hacking. I believe it was on this
list, but not sure.

Of course I can't find that message any more...

Could the original poster, please repost?

Thanks.

Gerry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mail not sent to certain mail accounts

2006-01-16 Thread Angelo Zanetti

Hi all.

I'm using the PHP mail function to send a confirmation email to a person 
once they register on the site. A few thing that happens with 2 of the 
mail accounts that we're testing to receive the mail is that the mail 
never is received. One of the mail accounts is a Yahoo account, the 
other a local email from a service provider.


What could be the factors contributing to this? Could it be anti-spam 
software? or could there be something else that is blocking the mail? Or 
could there be a problem with my PHP mail function?


All other mail account types (eg: hotmail, gmail etc...) are able to 
receive the email.


Any help would be great.
Thanks in advance!

--

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mail not sent to certain mail accounts

2006-01-16 Thread Albert
Angelo Zanetti wrote:
 I'm using the PHP mail function to send a confirmation email to a person 
 once they register on the site. A few thing that happens with 2 of the 
 mail accounts that we're testing to receive the mail is that the mail 
 never is received. One of the mail accounts is a Yahoo account, the 
 other a local email from a service provider.

It is most probably a SPAM filter.

Make sure that you are using a valid email address to send from and that the
relay you use is not blacklisted somewhere.

I tend to rather use PHPMailer
(http://www.phpclasses.org/browse/package/264.html) when sending email as it
does most of the hard work for you.

Albert
PS List replies only please!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail not sent to certain mail accounts

2006-01-16 Thread Miles Thompson

At 07:43 PM 1/16/2006, Angelo Zanetti wrote:


Hi all.

I'm using the PHP mail function to send a confirmation email to a person 
once they register on the site. A few thing that happens with 2 of the 
mail accounts that we're testing to receive the mail is that the mail 
never is received. One of the mail accounts is a Yahoo account, the other 
a local email from a service provider.


What could be the factors contributing to this? Could it be anti-spam 
software? or could there be something else that is blocking the mail? Or 
could there be a problem with my PHP mail function?


All other mail account types (eg: hotmail, gmail etc...) are able to 
receive the email.


Any help would be great.
Thanks in advance!

--

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052


There could be any number of reasons. Here are two:

1. How are you sending mail? Is each message generated individually, or are 
you bulking them, using the bcc: field? Anti-spam software targets this 
and often blocks mail sent this way.


2. Could you be in a blocked set of IP addresses? We generate emails every 
evening from ExpertHost.ca; at one time a spammer used one of their 
servers. A specific customer complained that he never received news of the 
next day's bulletin. Checking with his IT dept, and ExpertHost, led to the 
discovery about the spam, and the blocking his IT dept had put in place.


The end user can also be the problem, depending on how the anti-spam 
software is set up. Maybe the very frequency of mail from the same address 
triggers the block.


Is a complete and useful set of headers generated in the email? Do other 
Yahoo accounts receive your email? Have you talked to the local ISP?


This isn't much help, but the problem is a social one, not a PHP one.

Cheers - Miles


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.18/230 - Release Date: 1/14/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail not sent to certain mail accounts

2006-01-16 Thread Paul Scott

Angelo Zanetti wrote:
I'm using the PHP mail function to send a confirmation email to a person 
once they register on the site. A few thing that happens with 2 of the 


A bunch of times, I have found that some hosts will up the spam ante 
when you don't include almost _all_ of the headers.


What could be the factors contributing to this? Could it be anti-spam 
software? or could there be something else that is blocking the mail? Or 
could there be a problem with my PHP mail function?


Try put in, if not all, but most headers that you will ordinarily see in 
a desktop mail client:


  $headers=;
   $headers .= X-Sender:  $mail $mail\n; //
   $headers .=From: $mail_f $mail_f\n;
   $headers .= Reply-To: $mail_f $mail_f\n;
   $headers .= Date: .date(r).\n;
   $headers .= Message-ID: 
.date(YmdHis).you@.$_SERVER['SERVER_NAME'].\n;

   $headers .= Subject: $subject\n;
   $headers .= Return-Path: $mail_f $mail_f\n;
   $headers .= Delivered-to: $mail_f $mail_f\n;
   $headers .= MIME-Version: 1.0\n;
   $headers .= Content-type: text/html;charset=ISO-8859-9\n;
   $headers .= X-Priority: 1\n;
   $headers .= Importance: High\n;
   $headers .= X-MSMail-Priority: High\n;
   $headers .= X-Mailer: A PHP mailer!\n;


Any help would be great.


HTH

--Paul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail SMTP settings

2005-12-05 Thread Brent Baisley
There are a lot of limitations in the built-in PHP mail function. If  
you want more control over how your email is sent, try using  
phpmailer. It's all php code, so you can customize it to your needs,  
not that you need to.

http://phpmailer.sourceforge.net/


On Dec 3, 2005, at 2:45 AM, Dan wrote:

I have a PHP 4.x install on an Apache server.  I have a PHP  
application and a call to the mail function.  I have 2 static IP's  
on the server and I have one web server and one instance of postfix  
for each IP to basically separate the two sites.  The only issue I  
have right now is sending mail via PHP.


I have tried to set the SMTP server and reply address via a  
php_value in my httpd.conf file and via the ini_set function for my  
site in question.  Regardless of these setting mail is sent from  
the www user at my main site domain:


Return-Path: [EMAIL PROTECTED]
Received: from mail.wavefront.ca ([unix socket])
 by mail.wavefront.ca (Cyrus v2.2.12-OS X 10.4.0) with LMTPA;
 Fri, 02 Dec 2005 12:45:07 -0700

I've also tried the IMAP functions but also with no success.  I  
basically want the mail to look as though it was from the other  
domain.


Dan T

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mail SMTP settings

2005-12-05 Thread Mark Steudel
Also look at PEAR::Mail. If you search back through this list there was a
discussion on peoples preferences. 

-Original Message-
From: Brent Baisley [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 05, 2005 7:04 AM
To: Dan
Cc: php-general@lists.php.net
Subject: Re: [PHP] Mail SMTP settings

There are a lot of limitations in the built-in PHP mail function. If you
want more control over how your email is sent, try using phpmailer. It's all
php code, so you can customize it to your needs, not that you need to.
http://phpmailer.sourceforge.net/


On Dec 3, 2005, at 2:45 AM, Dan wrote:

 I have a PHP 4.x install on an Apache server.  I have a PHP 
 application and a call to the mail function.  I have 2 static IP's on 
 the server and I have one web server and one instance of postfix for 
 each IP to basically separate the two sites.  The only issue I have 
 right now is sending mail via PHP.

 I have tried to set the SMTP server and reply address via a php_value 
 in my httpd.conf file and via the ini_set function for my site in 
 question.  Regardless of these setting mail is sent from the www user 
 at my main site domain:

 Return-Path: [EMAIL PROTECTED]
 Received: from mail.wavefront.ca ([unix socket])
by mail.wavefront.ca (Cyrus v2.2.12-OS X 10.4.0) with LMTPA;
Fri, 02 Dec 2005 12:45:07 -0700

 I've also tried the IMAP functions but also with no success.  I 
 basically want the mail to look as though it was from the other 
 domain.

 Dan T

 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php



--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail SMTP settings

2005-12-04 Thread Curt Zirzow
On Sat, Dec 03, 2005 at 10:17:59PM -0700, Dan wrote:
 Yes that does work but the return path and my mail headers still show  
 the main domain.  My point is that PHP should be acessing my SMTP  
 server specified but it is using the default local host instead.

If you note at php.net/mail that the SMTP  setting is only for
windows. Under *nix only as current installed MTA like sendmail can
be used.

you can set your sendmail_path to pass parameters like :
  /sbin/sendmail -f [EMAIL PROTECTED]

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail SMTP settings

2005-12-03 Thread Curt Zirzow
On Sat, Dec 03, 2005 at 12:45:24AM -0700, Dan wrote:
 I have a PHP 4.x install on an Apache server.  I have a PHP  
 application and a call to the mail function.  I have 2 static IP's on  
 the server and I have one web server and one instance of postfix for  
 each IP to basically separate the two sites.  The only issue I have  
 right now is sending mail via PHP.
 
 I have tried to set the SMTP server and reply address via a php_value  
 in my httpd.conf file and via the ini_set function for my site in  
 question.  Regardless of these setting mail is sent from the www user  
 at my main site domain:

The ini setting is called 'sendmail_from'. or you can use the 5th
argument in the mail command.

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail SMTP settings

2005-12-03 Thread Dan
Yes that does work but the return path and my mail headers still show  
the main domain.  My point is that PHP should be acessing my SMTP  
server specified but it is using the default local host instead.


Dan T

On Dec 3, 2005, at 11:06 AM, Curt Zirzow wrote:


On Sat, Dec 03, 2005 at 12:45:24AM -0700, Dan wrote:

I have a PHP 4.x install on an Apache server.  I have a PHP
application and a call to the mail function.  I have 2 static IP's on
the server and I have one web server and one instance of postfix for
each IP to basically separate the two sites.  The only issue I have
right now is sending mail via PHP.

I have tried to set the SMTP server and reply address via a php_value
in my httpd.conf file and via the ini_set function for my site in
question.  Regardless of these setting mail is sent from the www user
at my main site domain:


The ini setting is called 'sendmail_from'. or you can use the 5th
argument in the mail command.

Curt.
--
cat .signature: No such file or directory

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail SMTP settings

2005-12-02 Thread Dan
I have a PHP 4.x install on an Apache server.  I have a PHP  
application and a call to the mail function.  I have 2 static IP's on  
the server and I have one web server and one instance of postfix for  
each IP to basically separate the two sites.  The only issue I have  
right now is sending mail via PHP.


I have tried to set the SMTP server and reply address via a php_value  
in my httpd.conf file and via the ini_set function for my site in  
question.  Regardless of these setting mail is sent from the www user  
at my main site domain:


Return-Path: [EMAIL PROTECTED]
Received: from mail.wavefront.ca ([unix socket])
 by mail.wavefront.ca (Cyrus v2.2.12-OS X 10.4.0) with LMTPA;
 Fri, 02 Dec 2005 12:45:07 -0700

I've also tried the IMAP functions but also with no success.  I  
basically want the mail to look as though it was from the other domain.


Dan T

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-18 Thread Curt Zirzow
On Fri, Nov 18, 2005 at 05:06:36PM -0800, Ligaya Turmelle wrote:
 
 $message - yes
 ---
 This usually can go without any special escaping, unless you have
 certain headers (the Boundary: header) or allow an injection into
 the $additional_headers field.  If this is the case a malicious
 user could attach a virus to be sent anonymously.
 
 Shouldn't you also worry about html script tags in the body of an HTML 
 email?  Couldn't a person also use those to send you a nasty present?

This is more of a second hand issue, but still valid nonetheless.
Depending on the client that sees the email and the context the
email was sent in, for example:

It is a rather common thing to send two parts, one just plain text
and another one with markup (usually html), and depending on how
the client reads things and displays it to the user, the outcome
could be lead to problems.

I usually use the Boundary: header as a good example of how one
could take advantage of non-escaped data, but that doesn't protect
someone from sending some well formed message that might perhaps
do some phishing type thing.


 
 
 $additional_headers - yes
 -
 As with $to, $subject you need to make sure \r and/or \n are
 removed or escaped properly.  The most common used header is the
 From header:
   
   From: $fromname $fromemail
 
 As noted in the $message section, if you have dont take care in
 ensuring this paramater isn't done correctly you could potentially
 allow the user to setup their own Boundary: header, which then
 would allow them to freely make what ever attachments they like.
 
 Also this is where the open (well psudo open) relay occurs, if you
 dont filter things properly, you can open up the CC: and BCC:
 headers, allowing the person to anonymously send emails.
 
 why would a person allow a user to input header information on a web 
 form?  That sounds like a HUGE security hole or is there someway I just 
 can't see?

The thing is that they dont realize that it is being allowed. If i
dont protect the variable $fromname from the ability to allow a
\n or \r\n someone could send me that results with:

$_POST['fromname'] == your friend\ [EMAIL PROTECTED]\r\nBCC: [a list of 
peoplel]\r\nNull: \;

Resulting in:

  From: your friend [EMAIL PROTECTED]
  BCC: [a list of people]
  Null:  thefromemail


and if I want to be tricky i'd slip in a coupld Recieved: headers
to throw off people the hint of what route the message took. Or
mabey another Subject: header to by pass the previous rules on
subject so I can get the subject I want. 


Curt.
--
null

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail Injection- Which Mail function Parameters

2005-11-17 Thread Chris Drozdowski

Hello,

When using the mail() function to send a simple mail message, which  
specific parameters of the function need to cleaned to prevent mail  
injection?


First of all I am already validating the $to parameter to be a valid  
email address.


After reading http://securephp.damonkohler.com/index.php/ 
Email_Injection, I gather the parameters that need to be cleaned to  
prevent mail injection are the $headers and the $additional_parameters.


Is this correct?

Do I also need to clean the $subject parameter to prevent mail  
injection?


What about the $message parameter?

Thanks,

C Drozdowski

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Chris Drozdowski

Hello,

When using the mail() function to send a simple mail message, which  
specific parameters of the function need to cleaned to prevent mail  
injection?


First of all I am already validating the $to parameter to be a valid  
email address.


After reading http://securephp.damonkohler.com/index.php/ 
Email_Injection, I gather the parameters that need to be cleaned to  
prevent mail injection are the $headers and the $additional_headers.


Is this correct?

Do I also need to clean the $subject parameter to prevent mail  
injection?


What about the $message parameter?

Thanks,

C Drozdowski

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Curt Zirzow
On Thu, Nov 17, 2005 at 07:10:06PM -0500, Chris Drozdowski wrote:
 Hello,
 
 When using the mail() function to send a simple mail message, which  
 specific parameters of the function need to cleaned to prevent mail  
 injection?

This is a good topic.  I'm in the process of writing an article on
it as well.

Consider:
mail ($to, $subject, $message, $additional_headers, $additional_parameters);

$to - yes (should clean)
--
As we've seen validating emails tends to be a long discussion on to
properly accomplish the validation.  Things to consider:

  - Are you going to allow them to send to multiple emails.
  - Do you want them to allow them to include the name of the
person the email is to: Joe Something [EMAIL PROTECTED]

based on what ever validation you choose and what you want to
allow, the key things to watch out for are the comma (,),
semicolon (;), line feed/carriage return (\r and/or \n)

  
$subject - yes
--
You want ensure that the \r and/or \n or properly removed (or
escaped)

$message - yes
---
This usually can go without any special escaping, unless you have
certain headers (the Boundary: header) or allow an injection into
the $additional_headers field.  If this is the case a malicious
user could attach a virus to be sent anonymously.

$additional_headers - yes
-
As with $to, $subject you need to make sure \r and/or \n are
removed or escaped properly.  The most common used header is the
From header:
  
  From: $fromname $fromemail

As noted in the $message section, if you have dont take care in
ensuring this paramater isn't done correctly you could potentially
allow the user to setup their own Boundary: header, which then
would allow them to freely make what ever attachments they like.

Also this is where the open (well psudo open) relay occurs, if you
dont filter things properly, you can open up the CC: and BCC:
headers, allowing the person to anonymously send emails.

additional_parameters - very much yes
-
The most common value passed here is usually something like:

  -f $fromemail

if you consider what this actually does, send parameters to the
sendmail binary directly you could open your self to exploits
unlreated to php itself.  Caution should really be used when
allowing outside data to be used here.

 
 After reading http://securephp.damonkohler.com/index.php/ 
 Email_Injection, I gather the parameters that need to be cleaned to  
 prevent mail injection are the $headers and the $additional_headers.

This is a nice article it rather makes me wonder if my article will
be as good as this one.

Curt.
-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Ligaya Turmelle



$message - yes
---
This usually can go without any special escaping, unless you have
certain headers (the Boundary: header) or allow an injection into
the $additional_headers field.  If this is the case a malicious
user could attach a virus to be sent anonymously.


Shouldn't you also worry about html script tags in the body of an HTML 
email?  Couldn't a person also use those to send you a nasty present?




$additional_headers - yes
-
As with $to, $subject you need to make sure \r and/or \n are
removed or escaped properly.  The most common used header is the

From header:
  
  From: $fromname $fromemail


As noted in the $message section, if you have dont take care in
ensuring this paramater isn't done correctly you could potentially
allow the user to setup their own Boundary: header, which then
would allow them to freely make what ever attachments they like.

Also this is where the open (well psudo open) relay occurs, if you
dont filter things properly, you can open up the CC: and BCC:
headers, allowing the person to anonymously send emails.


why would a person allow a user to input header information on a web 
form?  That sounds like a HUGE security hole or is there someway I just 
can't see?



--

life is a game... so have fun.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] mail return-path problem

2005-11-11 Thread Eric Butera
On 11/8/05, Richard Heyes [EMAIL PROTECTED] wrote:

 Eric Butera wrote:
  I was just curious if there was a way to set the return path of an email
  dynamically. I've looked around and all I could find was a Zend tutorial
  running sendmail from the command line, which I don't want to do. :)
 
  I tried setting Return-Path: in the mail() headers, but that didn't
 seem
  to make a difference. If anybody knows anything about this and could
 point
  me in the right direction, I'd appreciate it.
 
  Thanks!
 

 Use the fifth argument to the mail() function and the -f option for
 sendmail:

 mail('...', '...', '...', null, '[EMAIL PROTECTED]')

 --
 Richard Heyes
 http://www.phpguru.org


The -f was the trick. Thank you for all the input guys. =)


[PHP] mail return-path problem

2005-11-08 Thread Eric Butera
I was just curious if there was a way to set the return path of an email
dynamically. I've looked around and all I could find was a Zend tutorial
running sendmail from the command line, which I don't want to do. :)

I tried setting Return-Path: in the mail() headers, but that didn't seem
to make a difference. If anybody knows anything about this and could point
me in the right direction, I'd appreciate it.

Thanks!


Re: [PHP] mail return-path problem

2005-11-08 Thread Richard Heyes

Eric Butera wrote:

I was just curious if there was a way to set the return path of an email
dynamically. I've looked around and all I could find was a Zend tutorial
running sendmail from the command line, which I don't want to do. :)

I tried setting Return-Path: in the mail() headers, but that didn't seem
to make a difference. If anybody knows anything about this and could point
me in the right direction, I'd appreciate it.

Thanks!



Use the fifth argument to the mail() function and the -f option for 
sendmail:


mail('...', '...', '...', null, '[EMAIL PROTECTED]')

--
Richard Heyes
http://www.phpguru.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail return-path problem

2005-11-08 Thread Richard Lynch
On Tue, November 8, 2005 9:47 am, Eric Butera wrote:
 I was just curious if there was a way to set the return path of an
 email
 dynamically. I've looked around and all I could find was a Zend
 tutorial
 running sendmail from the command line, which I don't want to do. :)

 I tried setting Return-Path: in the mail() headers, but that didn't
 seem
 to make a difference. If anybody knows anything about this and could
 point
 me in the right direction, I'd appreciate it.

Works for me...

$from = '[EMAIL PROTECTED]';
$headers = From: $from\r\n;
$headers .= Reply-to: $from\r\n;
$headers .= Return-Path: $from\r\n;
mail($from, 'Test', This is a test.\r\n, $headers);

Note however, that your configuration of sendmail (or whatever is in
php.ini) could probably be configured to not accept a Return-Path
header...

CAN you run sendmail from the command line, as the PHP User, and get
Return-Path: to work?

If not, then PHP can't do it either.

That may have been the whole purpose of the tutorial...

Or, perhaps, the point was that for a static Return-Path: you could
set it in php.ini just as you would from the command line.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php mail function vs smtp server

2005-10-31 Thread Clive

Hi

does anyone know whats better/uses less resource etc:

If I run a loop to send a 1000 emails, should I use php's mail fucntions 
or send directly to the servers smtp server.


clive

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Paul Waring
On Mon, Oct 31, 2005 at 12:10:02PM +0200, Clive wrote:
 does anyone know whats better/uses less resource etc:
 
 If I run a loop to send a 1000 emails, should I use php's mail fucntions 
 or send directly to the servers smtp server.

What do you mean by send directly? Are you thinking of sending mail
manually through making a socket connection or something?

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Richard Davey
Hi Clive,

Monday, October 31, 2005, 10:10:02 AM, you wrote:

 does anyone know whats better/uses less resource etc:

 If I run a loop to send a 1000 emails, should I use php's mail fucntions
 or send directly to the servers smtp server.

Use PEAR Mail Queue.

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.launchcode.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Richard Heyes

Clive wrote:

Hi

does anyone know whats better/uses less resource etc:

If I run a loop to send a 1000 emails, should I use php's mail fucntions 
or send directly to the servers smtp server.


Depends on your setup. If you're on Linux/Unix you could use the mail() 
function along with the -odq option to Sendmail/Postfix/Exim etc 
(fifth argument to the mail() function) which will dump all the mails 
into the MTAs queue. After this, the MTA will handle delivery. This is 
probably the quickest for this platform.


--
Richard Heyes
http://www.phpguru.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Paul Waring
On Mon, Oct 31, 2005 at 12:38:09PM +0200, Clive wrote:
 what I mean is: im using a class called phpmailer and it has the option 
 to sent to a smtp server, I suppose this means that they do open a 
 socket to the smtp server.

All that means is that you can specify an external SMTP server (e.g.
mail.myisp.com), whereas mail() will use localhost instead. In this case
mail() would probably be quite a bit faster (though only if you're
sending thousands and thousands of emails) because it won't have to send
stuff out beyond the local machine.

Depending on what you want to do and how much control you have over the
machine your PHP scripts are running on, you might want to run a local
mail server that just relays everything to an external source (whatever
SMTP server you're currently using) - that way you can send everything
to that and your PHP script should return control a bit faster.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Marcus Bointon

On 31 Oct 2005, at 10:34, Richard Heyes wrote:

Depends on your setup. If you're on Linux/Unix you could use the  
mail() function along with the -odq option to Sendmail/Postfix/ 
Exim etc (fifth argument to the mail() function) which will dump  
all the mails into the MTAs queue. After this, the MTA will handle  
delivery. This is probably the quickest for this platform.


I agree. Sending directly is usually reserved for Windows machines  
with no local MTA and is usually way slower and doesn't handle  
queuing. I'd advise anyone to use PHPMailer for mail anyway as it  
makes it much more reliable to deal with all the other stuff like  
MIME encoding, plus it has support for all these sending methods  
without having to change much code. I use it with qmail.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Paul Waring
On Mon, Oct 31, 2005 at 12:56:01PM +0200, Clive wrote:
 Thanks I actually want to send 24 000 emails with 2 meg attachments.

Oh. You definitely don't want to be using an external SMTP server if you
can help it then, and you should really be splitting those up into
chunks (no more than 1,000 at a time really) using something like PEAR
Queue as has already been suggested.

 There also another option with the class: using the sendmail program, 
 but  won't the php mail function use sendmail anyway

As far as I know, mail() just sends stuff to whatever the sendmail
binary is on your system, although I haven't really looked into it. Of
course you don't have to be running sendmail as most MTA will install
binaries such as /usr/sbin/sendmail which actually point to postfix or
qmail or whatever you're running.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php mail function vs smtp server

2005-10-31 Thread Richard Lynch
On Mon, October 31, 2005 4:10 am, Clive wrote:
 does anyone know whats better/uses less resource etc:

 If I run a loop to send a 1000 emails, should I use php's mail
 fucntions
 or send directly to the servers smtp server.

SMTP

PHP's mail() function was never designed for high-volume email.

It fires up a different process of sendmail for EACH email.

This is NOT cheap, nor efficient.

mail() is convenient.  It is not efficient.

Use mail() for quickie one-off emails.

Use something else for mass email.

There are classes/packages you can use to make this painless.
http://phpclasses.org has at least one that gets used/recommended a lot.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



<    1   2   3   4   5   6   7   8   9   10   >