[PHP] Email Antispam

2012-04-17 Thread David Mehler
Hello,

I'm working on a site that has email addresses on it. I am not wanting
to use mailto links so as to avoid spam harvesters, I'd like another
solution so that mailto links would work but would not work with
spammers. I've tried several javascript-based solutions, but am not
able to get them to be consistent. It seems like once they're used
they revert to coded links. If anyone has any solutions I'd appreciate
it. I'm not sure I can do this in php, generate email addresses
dynamically then pass them to the client, it would be the same as the
spammer hitting the page. I'd prefer something self-hosted and
preferably light on the resources.

Thanks.
Dave.

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



Re: [PHP] Email Antispam

2012-04-17 Thread Marc Guay
Is there a reason for you not to build a contact form?

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



Re: [PHP] Email Antispam

2012-04-17 Thread Ashley Sheridan


Marc Guay marc.g...@gmail.com wrote:

Is there a reason for you not to build a contact form?

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

It could be for a company, which in the UK I believe requires several bits of 
contact information.

There is no php way of doing what you ask, php is all on the server after all. 
The only solution is javascript, but again, if its for a company, depending on 
country, you may have a legal requirement to make it accessible, which means 
basic required details available without script.

Having said that, with a contact form you may be ok. You could use javascript 
to output the email address link. I wrote one a while back:

http://www.ashleysheridan.co.uk/coding/javascript/Anti-Spam+Email+Script

Hope it helps?

Thanks,
Ash
http://ashleysheridan.co.uk

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



Re: [PHP] email w/attachments

2011-04-18 Thread Richard Quadling
On 18 April 2011 04:38, Bastien phps...@gmail.com wrote:




 On 2011-04-17, at 10:26 PM, tedd t...@sperling.com wrote:

 Hi gang:

 Anyone have an email script that allows attachments they would share?

 I've been trying to figure this out and everything I've tried has failed. 
 I've looked at over a dozen scripts that don't work. I'm about to pull out 
 what hair I have left.

 Cheers (I think),

 tedd

 --
 ---
 http://sperling.com/

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


 I use phpmailer for that. Great class and easy to do

 Bastien Koert

When I started out, I used the HtmlMimeMail class from Richard Heyes
at phpguru.org. It is now called RMail.

I found this very easy to use.

Extending the main class to include logging of mail is very easy (this
year, I've sent 33,500 emails using it).

I send email with a plain text part as well as a HTML part. With
embedded images and PDF attachments.

The recipients use a combination of Outlook (2003 and later),
GoogleMail and YahooMail.

All of the clients so far can read the messages sent and get the attachments.

If you intend to send HTML mail, you will have to go back to using
tables with inline CSS if you want to be halfway readable on Outlook
2007+. Outlook 2003 was very good with HTML mail. Outlook 2007+, not
so good. But that is fine for me, as the data was all tables. But for
those sending out pretty mails, I believe it is a harder job that
expected.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] email w/attachments

2011-04-18 Thread Steve Staples
On Mon, 2011-04-18 at 11:05 +0100, Richard Quadling wrote:
 On 18 April 2011 04:38, Bastien phps...@gmail.com wrote:
 
 
 
 
  On 2011-04-17, at 10:26 PM, tedd t...@sperling.com wrote:
 
  Hi gang:
 
  Anyone have an email script that allows attachments they would share?
 
  I've been trying to figure this out and everything I've tried has failed. 
  I've looked at over a dozen scripts that don't work. I'm about to pull out 
  what hair I have left.
 
  Cheers (I think),
 
  tedd
 
  --
  ---
  http://sperling.com/
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  I use phpmailer for that. Great class and easy to do
 
  Bastien Koert
 
 When I started out, I used the HtmlMimeMail class from Richard Heyes
 at phpguru.org. It is now called RMail.
 
 I found this very easy to use.
 
 Extending the main class to include logging of mail is very easy (this
 year, I've sent 33,500 emails using it).
 
 I send email with a plain text part as well as a HTML part. With
 embedded images and PDF attachments.
 
 The recipients use a combination of Outlook (2003 and later),
 GoogleMail and YahooMail.
 
 All of the clients so far can read the messages sent and get the attachments.
 
 If you intend to send HTML mail, you will have to go back to using
 tables with inline CSS if you want to be halfway readable on Outlook
 2007+. Outlook 2003 was very good with HTML mail. Outlook 2007+, not
 so good. But that is fine for me, as the data was all tables. But for
 those sending out pretty mails, I believe it is a harder job that
 expected.
 
 Richard.
 
 -- 
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
 

I use phpmailer[1], and even though most people dont like it, Pear
MAILER as well.  With both, I've sent both HTML and plain text, as well
as attachments without any issues.

phpmailer[1] is my mailer script of choice.

Steve.

[1] http://phpmailer.worxware.com/index.php


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



[PHP] email w/attachments

2011-04-17 Thread tedd

Hi gang:

Anyone have an email script that allows attachments they would share?

I've been trying to figure this out and everything I've tried has 
failed. I've looked at over a dozen scripts that don't work. I'm 
about to pull out what hair I have left.


Cheers (I think),

tedd

--
---
http://sperling.com/

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



Re: [PHP] email w/attachments

2011-04-17 Thread Adam Richardson
On Sun, Apr 17, 2011 at 10:26 PM, tedd t...@sperling.com wrote:

 Hi gang:

 Anyone have an email script that allows attachments they would share?

 I've been trying to figure this out and everything I've tried has failed.
 I've looked at over a dozen scripts that don't work. I'm about to pull out
 what hair I have left.


I use the Zend Framework for almost all email capabilities within my
scripts:
http://framework.zend.com/manual/1.0/en/zend.mail.attachments.html

Nice documentation, well tested, and often times I'll end up using one of
the other components in the framework before I'm done, anyway, so it's nice
to have the framework sitting on the server ready to go (and, if desired,
you can send emails using SMTP credentials in a snap.)

Additionally, you only have to use what you want of Zend, so I actually use
my own framework for managing the flow of the application, and I just
include the specific Zend files needed in a particular page.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] email w/attachments

2011-04-17 Thread Bastien




On 2011-04-17, at 10:26 PM, tedd t...@sperling.com wrote:

 Hi gang:
 
 Anyone have an email script that allows attachments they would share?
 
 I've been trying to figure this out and everything I've tried has failed. 
 I've looked at over a dozen scripts that don't work. I'm about to pull out 
 what hair I have left.
 
 Cheers (I think),
 
 tedd
 
 -- 
 ---
 http://sperling.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

I use phpmailer for that. Great class and easy to do

Bastien Koert
Sent from my iPhone
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] email address syntax checker

2011-01-23 Thread Govinda
 Peter Lind wrote:
 [snip]
 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
 echo Bad user! Bad user!;
 }
 
 Regards
 Peter
 
 
 thanks peter... wish I would have known about filter_var before
 writing the other checkers. ;-)


Hi D   :-)

I was following along.. also felt pleased to be introduced to filter_var ... 
and then happened to see this:

http://us3.php.net/manual/en/function.filter-var.php
the user-contributed note, headed with:
php dot 5 dot leenoble at SPAMMENOTspamgourmet dot net 18-Dec-2009 10:01

Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
not all) web based registration forms.

It will happily pronounce yourname as valid because presumably the 
@localhost is implied, so you still have to check that the domain portion of 
the address exists.


So I am surprised Peter recommended it.  (?)

AFAICT, I should stick with what I was using:

$emailPattern = '/^[\w\.\-_\+]+@[\w-]+(\.\w{2,4})+$/i'; //
$emailReplacement = 'theEmailAppearsValid';
$emailChecker = preg_replace($emailPattern, $emailReplacement, $emailToCheck);
if($emailChecker == 'theEmailAppearsValid') {
//--theEmailLooksValid, so use it...
} else {
//--theEmailLooksBad, so do not use it...
}



Govinda


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



Re: [PHP] email address syntax checker

2011-01-23 Thread Ashley Sheridan
On Sun, 2011-01-23 at 14:59 -0500, Govinda wrote:

  Peter Lind wrote:
  [snip]
  if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  echo Bad user! Bad user!;
  }
  
  Regards
  Peter
  
  
  thanks peter... wish I would have known about filter_var before
  writing the other checkers. ;-)
 
 
 Hi D   :-)
 
 I was following along.. also felt pleased to be introduced to filter_var ... 
 and then happened to see this:
 
 http://us3.php.net/manual/en/function.filter-var.php
 the user-contributed note, headed with:
 php dot 5 dot leenoble at SPAMMENOTspamgourmet dot net 18-Dec-2009 10:01
 
 Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
 not all) web based registration forms.
 
 It will happily pronounce yourname as valid because presumably the 
 @localhost is implied, so you still have to check that the domain portion 
 of the address exists.
 
 
 So I am surprised Peter recommended it.  (?)
 
 AFAICT, I should stick with what I was using:
 
 $emailPattern = '/^[\w\.\-_\+]+@[\w-]+(\.\w{2,4})+$/i'; //
 $emailReplacement = 'theEmailAppearsValid';
 $emailChecker = preg_replace($emailPattern, $emailReplacement, $emailToCheck);
 if($emailChecker == 'theEmailAppearsValid') {
   //--theEmailLooksValid, so use it...
 } else {
   //--theEmailLooksBad, so do not use it...
 }
 
 
 
 Govinda
 
 


A few posts back I posted a solution to a question about validating
domain names. You could use that to validate the portion after the last
'@' symbol (as an @ could validly occur in the local part of the email
address) and then validate the front part another way (I can't write all
the code for you ;p )

The domain code I used before was:

?php
$domain = www.ashleysheridan.co.uk;
$valid = false;

$tlds = array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov',
'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org',
'pro', 'tel', 'travel', 'xxx', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al',
'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba',
'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br',
'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch',
'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz',
'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et',
'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf',
'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im',
'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg',
'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc',
'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me',
'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt',
'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni',
'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph',
'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro',
'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj',
'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc',
'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr',
'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc',
've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm',
'zw', );


if(strlen($domain = 253))
{
$labels = explode('.', $domain);
if(in_array($labels[count($labels)-1], $tlds))
{
for($i=0; $icount($labels) -1; $i++)
{
if(strlen($labels[$i]) = 63  
(!preg_match('/^[a-z0-9][a-z0-9
\-]*?[a-z0-9]$/', $labels[$i]) ))
{
$valid = false;
break;  // no point continuing if one label is 
wrong
}
else
{
$valid = true;
}
}
}
}

var_dump($valid);

var_dump(filter_var(www.test.co.uk, FILTER_VALIDATE_URL));

It looks like a long chunk, but should validate the domain part
successfully. It doesn't look for the full Unicode-style domains, as
there are only a handful of services that use them, most servers tend to
default to using and displaying punycode instead, so this will still
validate those.

Note: I've removed the check in this snippet that checked for each label
of the domain to not consist of only numbers, as that only applies to
the TLD, I'd misread the spec a little! So this is better to use than
the code from the other thread.


Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] email address syntax checker

2011-01-23 Thread Donovan Brooke

Govinda wrote:
[snip]

Hi D   :-)

I was following along.. also felt pleased to be introduced to filter_var ... 
and then happened to see this:

http://us3.php.net/manual/en/function.filter-var.php

[snip]

Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
not all) web based registration forms.




Good to know G... (and yea, I read something similar).. but only 
administrators can add registrants in the system I'm building.. and even 
then, email is not required, so I'm not worried about it on this job, 
but I'll keep all the posts for this thread in mind for down the road.


Trying to finish a PHP book while watching the Packers is not working
for me too well. ;-)

Thanks,
Donovan


--
D Brooke

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



Re: [PHP] email address syntax checker

2011-01-23 Thread Govinda
 Trying to finish a PHP book while watching the Packers is not working
 for me too well. ;-)


yeah.. me trying to keep up with the php list, follow streams of thought from 
the posts that lead to things I need to yet learn, make time off from my 
other-language/full-time work..  wishing I could actually play Civ-V which I 
just bought..   .. not to mention my business idea guaranteed to make a mint 
and be a ton of fun (if I had a year off to code it)... ;-)


Govinda


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



RES: [PHP] email address syntax checker

2011-01-21 Thread Alejandro Michelin Salomon

Donovan:

Try this

function EmailCheck ( $sEmail )
 {
 
$regexp=/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z
]{2,}$/i;

 if ( !preg_match($regexp, $sEmail) )
return false;

 return true;
 }

Alejandro M.S.
-Mensagem original-
De: Donovan Brooke [mailto:li...@euca.us] 
Enviada em: quinta-feira, 20 de janeiro de 2011 01:14
Para: php-general@lists.php.net
Assunto: [PHP] email address syntax checker

Hi Guys,

I'm waddling my way through database interaction and thought someone on 
the list may already have a simple email checker that they'd like to 
share...

you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate 
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan


-- 
D Brooke

-- 
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: RES: [PHP] email address syntax checker

2011-01-21 Thread a...@ashleysheridan.co.uk
That won't accept dozens of different types of email addresses. It won't even 
match some value domains.

Valid email addresses can contain virtually any character in the local part 
(although in the main they will require being inside quotation marks), and the 
@ symbol is included in that!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Alejandro Michelin Salomon amichel...@hotmail.com
Date: Fri, Jan 21, 2011 12:14
Subject: RES: [PHP] email address syntax checker
To: 'Donovan Brooke' li...@euca.us
Cc: php-general@lists.php.net



Donovan:

Try this

function EmailCheck ( $sEmail )
 {
 
$regexp=/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z
]{2,}$/i;

 if ( !preg_match($regexp, $sEmail) )
return false;

 return true;
 }

Alejandro M.S.
-Mensagem original-
De: Donovan Brooke [mailto:li...@euca.us] 
Enviada em: quinta-feira, 20 de janeiro de 2011 01:14
Para: php-general@lists.php.net
Assunto: [PHP] email address syntax checker

Hi Guys,

I'm waddling my way through database interaction and thought someone on 
the list may already have a simple email checker that they'd like to 
share...

you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate 
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan


-- 
D Brooke

-- 
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: RES: [PHP] email address syntax checker

2011-01-21 Thread Richard Quadling
On 21 January 2011 11:38, a...@ashleysheridan.co.uk
a...@ashleysheridan.co.uk wrote:
 That won't accept dozens of different types of email addresses. It won't even 
 match some value domains.

 Valid email addresses can contain virtually any character in the local part 
 (although in the main they will require being inside quotation marks), and 
 the @ symbol is included in that!

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

 - Reply message -
 From: Alejandro Michelin Salomon amichel...@hotmail.com
 Date: Fri, Jan 21, 2011 12:14
 Subject: RES: [PHP] email address syntax checker
 To: 'Donovan Brooke' li...@euca.us
 Cc: php-general@lists.php.net



 Donovan:

 Try this

 function EmailCheck ( $sEmail )
  {

 $regexp=/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z
 ]{2,}$/i;

     if ( !preg_match($regexp, $sEmail) )
        return false;

     return true;
  }

 Alejandro M.S.
 -Mensagem original-
 De: Donovan Brooke [mailto:li...@euca.us]
 Enviada em: quinta-feira, 20 de janeiro de 2011 01:14
 Para: php-general@lists.php.net
 Assunto: [PHP] email address syntax checker

 Hi Guys,

 I'm waddling my way through database interaction and thought someone on
 the list may already have a simple email checker that they'd like to
 share...

 you know, looking for the @ char and dots etc..

 I did a quick search of the archives and found a couple elaborate
 things.. but
 I'm looking for something simple. This job will have trusted users and
 the checker is more to help them catch mistakes when registering.

 Thanks!,
 Donovan


 --
 D Brooke

 --
 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



http://www.regular-expressions.info/email.html makes a good argument
about the futility of using JUST one massive regex to validate email
addresses.

The long and short of it is the standard says that this should work ...

(?:[a-z0-9!#$%'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

Which is ...



(?:[a-z0-9!#$%'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

Which (using RegexBuddy) is explained as ...

Options: case insensitive; ^ and $ match at line breaks

Match the regular expression below
«(?:[a-z0-9!#$%'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%'*+/=?^_`{|}~-]+)*|(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*)»
   Match either the regular expression below (attempting the next
alternative only if this one fails)
«[a-z0-9!#$%'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%'*+/=?^_`{|}~-]+)*»
  Match a single character present in the list below
«[a-z0-9!#$%'*+/=?^_`{|}~-]+»
 Between one and unlimited times, as many times as possible,
giving back as needed (greedy) «+»
 A character in the range between “a” and “z” «a-z»
 A character in the range between “0” and “9” «0-9»
 One of the characters “!#$%'*+/=?^_`{|}” «!#$%'*+/=?^_`{|}»
 The character “~” «~»
 The character “-” «-»
  Match the regular expression below «(?:\.[a-z0-9!#$%'*+/=?^_`{|}~-]+)*»
 Between zero and unlimited times, as many times as possible,
giving back as needed (greedy) «*»
 Match the character “.” literally «\.»
 Match a single character present in the list below
«[a-z0-9!#$%'*+/=?^_`{|}~-]+»
Between one and unlimited times, as many times as
possible, giving back as needed (greedy) «+»
A character in the range between “a” and “z” «a-z»
A character in the range between “0” and “9” «0-9»
One of the characters “!#$%'*+/=?^_`{|}” «!#$%'*+/=?^_`{|}»
The character “~” «~»
The character “-” «-»
   Or match regular expression number 2 below (the entire group fails
if this one fails to match)
«(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*»
  Match the character “” literally «»
  Match the regular expression below
«(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*»
 Between zero and unlimited times, as many times as possible,
giving back as needed (greedy) «*»
 Match either the regular

Re: [PHP] email address syntax checker

2011-01-21 Thread Nilesh Govindarajan

On 01/21/2011 06:25 AM, Andre Polykanine wrote:

Hej Nisse,

Me thinks it isn't a valid address :-).




Okay let me tell you guys one more thing that the validator I posted 
earlier is not exactly as per RFC. It does have some variations. 
@@example.com may be a valid email address, but I doubt very much if 
any provider in the universe gives such an address?


It has been coded partially according to RFC and partially according to 
common sense.


[[NO FLAMES]]

--
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



Re: [PHP] email address syntax checker

2011-01-21 Thread Nisse Engström
On Fri, 21 Jan 2011 18:32:56 +0530, Nilesh Govindarajan wrote:

 Okay let me tell you guys one more thing that the validator I posted 
 earlier is not exactly as per RFC. It does have some variations. 
 @@example.com may be a valid email address, but I doubt very much if 
 any provider in the universe gives such an address?

Sending to, and receiving at @@luden.se seems to work
fine here.


/Nisse

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



Re: [PHP] email address syntax checker

2011-01-20 Thread Nilesh Govindarajan

On 01/20/2011 09:44 AM, Donovan Brooke wrote:

Hi Guys,

I'm waddling my way through database interaction and thought someone on
the list may already have a simple email checker that they'd like to
share...

you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan




Well, I had created an email validator long ago, after a neat research 
on Google, reading RFCs, etc.
I don't guarantee that it's without bugs, but it has been correct for me 
in all valid  invalid email addresses I used for test.


Code:

?php

function checkMail($mail) {

  if(strlen($mail) = 0) {
return false;
  }

  $split = explode('@', $mail);

  if(count($split)  2) {
return false;
  }

  list($username, $domain) = $split;

  /* 



   * Don't allow
   * Two dots, Two @
   * !, #, $, ^, , *, (, ), [, ], {, }, ?, /, \, ~, `, , , ', 
   */

  $userNameRegex1 = 
'/\.{2,}|@{2,}|[\!#\$\^\*\(\)\[\]{}\?\/\\\|~`\']+/';


  /*
   * Username should consist of only
   * A-Z, a-z, 0-9, -, ., _, +, %
   */

  $userNameRegex2 = '/[a-z0-9_.+%-]+/i';

  /*
   * Domain cannot contain two successive dots
   */

  $domainRegex1 = '/\.{2,}/';

  /*
   * Domain can contain only
   * A-Z, a-z, 0-9, ., -,
   */

  $domainRegex2 = '/[a-z0-9.-]+/i';

  if(preg_match($userNameRegex1, $username) or
!preg_match($userNameRegex2, $username) or
 preg_match($domainRegex1, $domain) or
!preg_match($domainRegex2, $domain) or
!checkdnsrr($domain, 'MX')) {
return false;
  } else {
return true;
  }

}


--
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



Re: [PHP] email address syntax checker

2011-01-20 Thread Donovan Brooke

Peter Lind wrote:
[snip]

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
 echo Bad user! Bad user!;
}

Regards
Peter



thanks peter... wish I would have known about filter_var before
writing the other checkers. ;-)

Donovan


--
D Brooke

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



Re: [PHP] email address syntax checker

2011-01-20 Thread Donovan Brooke

Nilesh Govindarajan wrote:

On 01/20/2011 09:44 AM, Donovan Brooke wrote:

Hi Guys,

I'm waddling my way through database interaction and thought someone on
the list may already have a simple email checker that they'd like to
share...

you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan




Well, I had created an email validator long ago, after a neat research
on Google, reading RFCs, etc.
I don't guarantee that it's without bugs, but it has been correct for me
in all valid  invalid email addresses I used for test.

Code:

?php

function checkMail($mail) {

if(strlen($mail) = 0) {
return false;
}

$split = explode('@', $mail);

if(count($split)  2) {
return false;
}

list($username, $domain) = $split;

/*

* Don't allow
* Two dots, Two @
* !, #, $, ^, , *, (, ), [, ], {, }, ?, /, \, ~, `, , , ', 
*/

$userNameRegex1 = '/\.{2,}|@{2,}|[\!#\$\^\*\(\)\[\]{}\?\/\\\|~`\']+/';

/*
* Username should consist of only
* A-Z, a-z, 0-9, -, ., _, +, %
*/

$userNameRegex2 = '/[a-z0-9_.+%-]+/i';

/*
* Domain cannot contain two successive dots
*/

$domainRegex1 = '/\.{2,}/';

/*
* Domain can contain only
* A-Z, a-z, 0-9, ., -,
*/

$domainRegex2 = '/[a-z0-9.-]+/i';

if(preg_match($userNameRegex1, $username) or
!preg_match($userNameRegex2, $username) or
preg_match($domainRegex1, $domain) or
!preg_match($domainRegex2, $domain) or
!checkdnsrr($domain, 'MX')) {
return false;
} else {
return true;
}

}



Thanks! I think I'll go w/ Peter's suggestion for this site, but will
take note of this for reference's sake!

Cheers,
Donovan


--
D Brooke

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



Re: [PHP] email address syntax checker

2011-01-20 Thread Nisse Engström
On Thu, 20 Jan 2011 19:03:22 +0530, Nilesh Govindarajan wrote:

 Well, I had created an email validator long ago, after a neat research 
 on Google, reading RFCs, etc.
 I don't guarantee that it's without bugs, but it has been correct for me 
 in all valid  invalid email addresses I used for test.
 
 Code:
 
 ?php
 
 function checkMail($mail) {
 
if(strlen($mail) = 0) {
  return false;
}
 
$split = explode('@', $mail);
 
if(count($split)  2) {
  return false;
}

@@example.com is not a valid address?


/Nisse

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



Re: [PHP] email address syntax checker

2011-01-20 Thread Andre Polykanine
Hej Nisse,

Me thinks it isn't a valid address :-).


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Nisse Engström news.nospam.0ixbt...@luden.se
To: php-general@lists.php.net
Date created: , 2:25:01 AM
Subject: [PHP] email address syntax checker


  On Thu, 20 Jan 2011 19:03:22 +0530, Nilesh Govindarajan wrote:

 Well, I had created an email validator long ago, after a neat research 
 on Google, reading RFCs, etc.
 I don't guarantee that it's without bugs, but it has been correct for me 
 in all valid  invalid email addresses I used for test.
 
 Code:
 
 ?php
 
 function checkMail($mail) {
 
if(strlen($mail) = 0) {
  return false;
}
 
$split = explode('@', $mail);
 
if(count($split)  2) {
  return false;
}

@@example.com is not a valid address?


/Nisse

-- 
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] email address syntax checker

2011-01-19 Thread Donovan Brooke

Hi Guys,

I'm waddling my way through database interaction and thought someone on 
the list may already have a simple email checker that they'd like to 
share...


you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate 
things.. but

I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan


--
D Brooke

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



Re: [PHP] email address syntax checker

2011-01-19 Thread David Hutto
On Wed, Jan 19, 2011 at 11:14 PM, Donovan Brooke li...@euca.us wrote:
 Hi Guys,

 I'm waddling my way through database interaction and thought someone on the
 list may already have a simple email checker that they'd like to share...

 you know, looking for the @ char and dots etc..

 I did a quick search of the archives and found a couple elaborate things..
 but
 I'm looking for something simple.

Simple is an irrelevant term, you'd have to elaborate on your current
experience.

 This job will have trusted users and
 the checker is more to help them catch mistakes when registering.

 Thanks!,
 Donovan


 --
 D Brooke

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





-- 
The lawyer in me says argue...even if you're wrong. The scientist in
me... says shut up, listen, and then argue. But the lawyer won on
appeal, so now I have to argue due to a court order.

Furthermore, if you could be a scientific celebrity, would you want
einstein sitting around with you on saturday morning, while you're
sitting in your undies, watching Underdog?...Or better yet, would
Einstein want you to violate his Underdog time?

Can you imagine Einstein sitting around in his underware? Thinking
about the relativity between his cotton nardsac, and his Fruit of the
Looms?

But then again, J. Edgar Hoover would want his pantyhose intertwined
within the equation.

However, I digress, momentarily.

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



Re: [PHP] email address syntax checker

2011-01-19 Thread Peter Lind
On 20 January 2011 05:14, Donovan Brooke li...@euca.us wrote:
 Hi Guys,

 I'm waddling my way through database interaction and thought someone on the
 list may already have a simple email checker that they'd like to share...

 you know, looking for the @ char and dots etc..

 I did a quick search of the archives and found a couple elaborate things..
 but
 I'm looking for something simple. This job will have trusted users and
 the checker is more to help them catch mistakes when registering.

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo Bad user! Bad user!;
}

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



[PHP] email list 101

2011-01-16 Thread Kirk Bailey
So, in php, I want a program to handle sending out a mail list. All this 
is going to do is be a filter to exclude non subscribers, and send a 
copy to every person in the subscriber file. This is pretty simple in 
python, but this is not my mother tounge we speak here, so let's talk in 
php instead.


If the submission does not come from a member, the script simply aborts. 
So the script should read the subscriber file, and if the source From: 
does not appear there, DIE. If it is there, walk the array and send a 
copy there, then end.


Now how to do this in php? Is there an off the shelf solution?


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



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



Re: [PHP] email list 101

2011-01-16 Thread David McGlone
On Sunday, January 16, 2011 10:09:03 am Kirk Bailey wrote:
 So, in php, I want a program to handle sending out a mail list. All this
 is going to do is be a filter to exclude non subscribers, and send a
 copy to every person in the subscriber file. This is pretty simple in
 python, but this is not my mother tounge we speak here, so let's talk in
 php instead.
 
 If the submission does not come from a member, the script simply aborts.
 So the script should read the subscriber file, and if the source From:
 does not appear there, DIE. If it is there, walk the array and send a
 copy there, then end.
 
 Now how to do this in php? Is there an off the shelf solution?

Have you tried Majordomo? 

-- 
Blessings
David M.

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



Re: [PHP] email list 101

2011-01-16 Thread Jim Lucas

On 1/16/2011 7:09 AM, Kirk Bailey wrote:

So, in php, I want a program to handle sending out a mail list. All this
is going to do is be a filter to exclude non subscribers, and send a
copy to every person in the subscriber file. This is pretty simple in
python, but this is not my mother tounge we speak here, so let's talk in
php instead.

If the submission does not come from a member, the script simply aborts.
So the script should read the subscriber file, and if the source From:
does not appear there, DIE. If it is there, walk the array and send a
copy there, then end.

Now how to do this in php? Is there an off the shelf solution?




Is this something that you plan on executing with your SMTP server or 
through a web script?

Do you care how the subscribers file is managed?  If at all...
How is the subscriber file formatted?

With the above questions unanswered, I would do something along the 
lines of the following.


form.php:
html
form action=process.php method=post
INPUT:fromname:value (display name)
INPUT:fromaddr:value (email address)
INPUT:subject:Something special
INPUT:message:the message goes here
/form
/html


process.php:
?php

# Clean input
if (get_magic_quotes_gpc())
$clean_post = array_map('stripslashes', $_POST);


# Check for required fields
$msg = 'Please press your back button and try again.';
if ( empty($clean_post['fromaddr']) )
die('From address is required.  '.$msg);
if ( empty($clean_post['subject']) )
die('Subject is required.  '.$msg);
if ( empty($clean_post['message']) )
die('Message is required.  '.$msg);

# Error on bad input
if ( !empty($clean_post['fromname']) 
 strpos($clean_post['fromname'], PHP_EOL) )
die('Invalid from name.  ' . $msg);
if ( strpos($clean_post['fromaddr'], PHP_EOL) !== false )
die('Invalid from address.  ' . $msg);
if ( strpos($clean_post['subject'], PHP_EOL) !== false )
die('Invalid subject.  ' . $msg);

# assuming the format is one email address per line
$subscriber_file = '/path/to/file';

$subscribers = array();
if ( file_exists($subscriber_file) )
$subscribers = @file($subscriber_file);

# Check for the submitters email address in the subscribers list
if ( !in_array($clean_post['fromaddr'], $subscribers) )
die('I don't see your email address in this list.  ' . $msg);

# By this point, everything should be checked and you should be ready
# to send your messages

# NOTE: Download and install a copy of phpmailer
# NOTE: the remaining is from the example.php included in phpmailer
# NOTE: I suggest using SMTP auth because it will allow you to generate
#   an email using a 3rd party email address then what is probably
#   allowed by your local mail server.

include '/path/to/phpmailer/class.phpmailer.php';

$mail = new PHPMailer();

$mail-IsSMTP(); // set mailer to use SMTP
$mail-Host = mail.example.com;  // specify mail server host name
$mail-SMTPAuth = true; // turn on SMTP authentication
$mail-Username = fill this in;  // SMTP username
$mail-Password = fill this in; // SMTP password

$mail-From = $clean_post['fromaddr'];
if ( !empty($clean_post['fromname']) )
{
  $mail-FromName = $clean_post['fromname'];
  $mail-AddReplyTo($clean_post['fromaddr'], $clean_post['fromname']);
} else {
  $mail-AddReplyTo($clean_post['fromaddr']);
}
$mail-Subject = $clean_post['subject'];
$mail-Body= $clean_post['message'];
$mail-AltBody = strip_tags($clean_post['message']);

# add each person
foreach ( $subscribers AS $addr )
{
  $mail-AddAddress($addr);
  # if you have a name associated to that address, do this instead
  # assuming line format as: em...@address.com,My Name
  list($addr, $name) = explode(',', $addr, 2)
  $mail-AddAddress($addr, $name);
}

if(!$mail-Send())
{
  echo Message could not be sent. p;
  echo Mailer Error:  . $mail-ErrorInfo;
  exit;
}

if ( ! headers_sent() )
  header('Location: http://www.example.com/done.php');

?

--
Jim Lucas

DISCLAIMER: Unless otherwise noted, all code is untested!

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



Re: [PHP] email list 101

2011-01-16 Thread Paul M Foster
On Sun, Jan 16, 2011 at 10:09:03AM -0500, Kirk Bailey wrote:

 So, in php, I want a program to handle sending out a mail list. All this
 is going to do is be a filter to exclude non subscribers, and send a
 copy to every person in the subscriber file. This is pretty simple in
 python, but this is not my mother tounge we speak here, so let's talk in
 php instead.
 
 If the submission does not come from a member, the script simply aborts.
 So the script should read the subscriber file, and if the source From:
 does not appear there, DIE. If it is there, walk the array and send a
 copy there, then end.
 
 Now how to do this in php? Is there an off the shelf solution?

There are some non-obvious issues, like throttling, which would attach
to this kind of project. Failure to consider them all might sink you.

If you simply wanted to be able to send emails from you to a bunch of
people on a list, I'd suggest PHPList. But if you want anyone to be able
to submit those emails, I'd suggest either Majordomo (Perl) or Mailman
(Python). If there's a comparable PHP solution, I'm not aware of it.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] PHP Email Question

2010-10-01 Thread kranthi
I cant see why you are getting the letter 'z' (assuming $msgContent
was referenced properly) . Complete code will be helpful to debug the
problem.

Also, Heredoc syntax will be more helpful in your situation. And usage
of global keyword is strongly discouraged in favor of $GLOBALS
superglobal array

http://php.net/GLOBALS
http://php.net/heredoc

Kranthi.
http://goo.gl/e6t3

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



Re: [PHP] PHP Email Question

2010-09-30 Thread J Ravi Menon
On Wed, Sep 29, 2010 at 1:37 PM, Joe Jackson priory...@googlemail.com wrote:
 Hi

 I am trying the following snippet as Bostjan  suggested, and an email is
 getting sent when I submit the form however in the body of the email I am
 getting none of the form data in the body of the email.  All I am getting is
 the letter 'z' ?  Also in the from field of the email this is showing as my
 email address and not the email address of the user who has sent the form

 Any ideas on where I am going wrong with this snippet?  Any advice would be
 much appreciated

 $msgContent = Name: . $values['name'] .\n;
 $msgContent .= Address: . $values['address'] .\n;
 $msgContent .= Telephone: . $values['telephone'] .\n;
 $msgContent .= Email Address: . $values['emailaddress'] .\n;
 $msgContent .= Message: . $values['message'] .\n;

 function ProcessForm($values)
 {
     mail('myemail:domain.com', 'Website Enquiry', $msgContent, From:
 \{$values['name']}\ {$values['emailaddress']});

  // Replace with actual page or redirect :P
     echo htmlheadtitleThank you!/title/headbodyThank
 you!/body/html;

Not sure if it it is a typo above, are you actually passing
$msgContent in the function above? If it is a global variable, you
would need to add a 'global' declaration:

function ProcessForm($values)
{
   global $msgContent;

mail('myemail:domain.com', 'Website Enquiry', $msgContent, From:
\{$values['name']}\ {$values['emailaddress']}\r\n);
.
.
.
}

Also try adding CRLF sequence at the end of the header line as shown above.

Ravi

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



Re: [PHP] PHP Email Question

2010-09-29 Thread Joe Jackson
Hi

I am trying the following snippet as Bostjan  suggested, and an email is
getting sent when I submit the form however in the body of the email I am
getting none of the form data in the body of the email.  All I am getting is
the letter 'z' ?  Also in the from field of the email this is showing as my
email address and not the email address of the user who has sent the form

Any ideas on where I am going wrong with this snippet?  Any advice would be
much appreciated


$msgContent = Name: . $values['name'] .\n;
$msgContent .= Address: . $values['address'] .\n;
$msgContent .= Telephone: . $values['telephone'] .\n;
$msgContent .= Email Address: . $values['emailaddress'] .\n;
$msgContent .= Message: . $values['message'] .\n;

function ProcessForm($values)
{
mail('myemail:domain.com', 'Website Enquiry', $msgContent, From:
\{$values['name']}\ {$values['emailaddress']});

 // Replace with actual page or redirect :P
echo htmlheadtitleThank you!/title/headbodyThank
you!/body/html;


Re: [PHP] PHP Email Question

2010-09-21 Thread J Ravi Menon
Just on this topic, I found swiftmailer library to be really useful
esp. in dealing with 'template' emails with custom variables per
recipient:

http://swiftmailer.org/

The e.g. on email template processing:

http://swiftmailer.org/docs/decorator-plugin-howto

There are batchSend() functionalities, ability to compose various mime
type emails etc...

Ravi

On Mon, Sep 20, 2010 at 8:20 AM, chris h chris...@gmail.com wrote:
 Ignore the other parameters unless you are very familiar with RFCs 2821,
 2822 and their associated RFCs



 I would advise against ignoring the other parameters.  Doing so will pretty
 much guarantee having your email end up in SPAM.  Instead look up the
 examples in the docs, or better yet use something like phpmailer as Tom
 suggested.


 Chris.


 On Sun, Sep 19, 2010 at 6:37 PM, TR Shaw ts...@oitc.com wrote:


 On Sep 19, 2010, at 6:00 PM, Joe Jackson wrote:

  Hi
 
  Sorry for the simple question but I am trying to get my head around PHP.
  I
  have a sample PHP script that I am trying to use to send a php powered
 email
  message.  The snippet of code is shown below
 
     mail('em...@address.com', 'Subject', $values['message'], From:
  \{$values['name']}\ {$values['emailaddress']});
 
  This works fine, but how can I add in other fields to the email that is
  recieved?
 
  For example in the form there are fields called, 'emailaddress',
  'telephone', 'address' and 'name' which I need to add into the form along
  with the message field
 
  Also with the formatting how can I change the format of the email to
 
  Name: $values['name'],
  Address: etc
  Message:
 

 Joe

 The mail command lets you send mail (an RFC2821 envelop). The function is:

 bool mail ( string $to , string $subject , string $message [, string
 $additional_headers [, string$additional_parameters ]] )

 $to is where you want it to go
 $subject is whatever you want the subject to be
 $message is the information you want to send

 Ignore the other parameters unless you are very familiar with RFCs 2821,
 2822 and their associated RFCs


 So if you want to send info from a form you might want to roll it up in xml
 and send it via the message part. when you receive it you can easily decode
 it. If you don't want to do that put it in a format that you can easily
 decode on the receiving end.

 Basically mail is a way to deliver information in the $message body. How
 you format the information there is up to you. However, depending on your
 system's config you are probably constrained to placing only 7bit ascii in
 the $message body.

 You might also move away from the mail function and look at phpmailer at
 sf.net if you need more complex capabilities.

 Tom






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



[PHP] PHP Email Question

2010-09-19 Thread Joe Jackson
Hi

Sorry for the simple question but I am trying to get my head around PHP.  I
have a sample PHP script that I am trying to use to send a php powered email
message.  The snippet of code is shown below

mail('em...@address.com', 'Subject', $values['message'], From:
\{$values['name']}\ {$values['emailaddress']});

This works fine, but how can I add in other fields to the email that is
recieved?

For example in the form there are fields called, 'emailaddress',
'telephone', 'address' and 'name' which I need to add into the form along
with the message field

Also with the formatting how can I change the format of the email to

Name: $values['name'],
Address: etc
Message:

TIA


Re: [PHP] PHP Email Question

2010-09-19 Thread Bostjan Skufca
You should format the email message content first, like this:
$msgContent = Name: . $values['name'] .\n;
$msgContent .= Address: . $values['address'] .\n;

Then you should send a this content, like this:
mail('em...@address.com', 'Subject', $msgContent, From...);

b.


On 20 September 2010 00:00, Joe Jackson priory...@googlemail.com wrote:
 Hi

 Sorry for the simple question but I am trying to get my head around PHP.  I
 have a sample PHP script that I am trying to use to send a php powered email
 message.  The snippet of code is shown below

    mail('em...@address.com', 'Subject', $values['message'], From:
 \{$values['name']}\ {$values['emailaddress']});

 This works fine, but how can I add in other fields to the email that is
 recieved?

 For example in the form there are fields called, 'emailaddress',
 'telephone', 'address' and 'name' which I need to add into the form along
 with the message field

 Also with the formatting how can I change the format of the email to

 Name: $values['name'],
 Address: etc
 Message:

 TIA


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



Re: [PHP] PHP Email Question

2010-09-19 Thread TR Shaw

On Sep 19, 2010, at 6:00 PM, Joe Jackson wrote:

 Hi
 
 Sorry for the simple question but I am trying to get my head around PHP.  I
 have a sample PHP script that I am trying to use to send a php powered email
 message.  The snippet of code is shown below
 
mail('em...@address.com', 'Subject', $values['message'], From:
 \{$values['name']}\ {$values['emailaddress']});
 
 This works fine, but how can I add in other fields to the email that is
 recieved?
 
 For example in the form there are fields called, 'emailaddress',
 'telephone', 'address' and 'name' which I need to add into the form along
 with the message field
 
 Also with the formatting how can I change the format of the email to
 
 Name: $values['name'],
 Address: etc
 Message:
 

Joe

The mail command lets you send mail (an RFC2821 envelop). The function is:

bool mail ( string $to , string $subject , string $message [, string 
$additional_headers [, string$additional_parameters ]] )

$to is where you want it to go
$subject is whatever you want the subject to be
$message is the information you want to send
Ignore the other parameters unless you are very familiar with RFCs 2821, 2822 
and their associated RFCs

So if you want to send info from a form you might want to roll it up in xml and 
send it via the message part. when you receive it you can easily decode it. If 
you don't want to do that put it in a format that you can easily decode on the 
receiving end.

Basically mail is a way to deliver information in the $message body. How you 
format the information there is up to you. However, depending on your system's 
config you are probably constrained to placing only 7bit ascii in the $message 
body.

You might also move away from the mail function and look at phpmailer at sf.net 
if you need more complex capabilities.

Tom





[PHP] Email from php

2010-05-19 Thread Ferdi
Hi List,

I have met with little success sending mail from PHP. I have used mainly the
mail() function but have also tried imap_mail() which the documentation says
is just a wrapper around mail().

Here is my understanding of the situation:
On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
smtp.someserver.com. I guess this works because the server I use relays all
mail received; it does not check if the user has been registered or not. It
obviously does not bother about the password.

On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
work. On Linux, what I have understood, is that the smtp server settings in
php.ini do not matter. The sendmail / mail (something like that) utility is
called which sends the mail. I have put in the correct sendmail_path setting
in php.ini, but, I guess this utility is not configured since I don't
receive the mail and running the code does not throw up errors or warnings.

What I need to achieve is the ability to send attachments in an email from
PHP. I would like one of the following options (in order of preference):

1. Create an email account (specifically Google Apps Mail) and send email as
that user. This will not be trivial. I will need to get a fix on
authenticating, logging in etc.
OR
2. Send mail using an SMTP server. Could you also point me to links showing
installation / setting up of a SMTP server on Linux? The XAMPP docs say the
Mercury mailserver is included, but I couldn't find any help for setting it
up.
OR
3. Configuring the sendmail utility on Linux

Alternaltly, any URLs giving the entire picture are also welcome. So far, I
have only found info that is almost verbatim copy of the PHP manual. They
just explain the different mail libraries and functions without considering
the mail servers and all the back end.

Thanks for taking the trouble to read!

Regards,
Ferdi


Re: [PHP] Email from php

2010-05-19 Thread Peter Lind
On 19 May 2010 13:27, Ferdi ferdinan...@printo.in wrote:
 Hi List,

 I have met with little success sending mail from PHP. I have used mainly the
 mail() function but have also tried imap_mail() which the documentation says
 is just a wrapper around mail().

 Here is my understanding of the situation:
 On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
 smtp.someserver.com. I guess this works because the server I use relays all
 mail received; it does not check if the user has been registered or not. It
 obviously does not bother about the password.

 On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
 work. On Linux, what I have understood, is that the smtp server settings in
 php.ini do not matter. The sendmail / mail (something like that) utility is
 called which sends the mail. I have put in the correct sendmail_path setting
 in php.ini, but, I guess this utility is not configured since I don't
 receive the mail and running the code does not throw up errors or warnings.

 What I need to achieve is the ability to send attachments in an email from
 PHP. I would like one of the following options (in order of preference):

 1. Create an email account (specifically Google Apps Mail) and send email as
 that user. This will not be trivial. I will need to get a fix on
 authenticating, logging in etc.
 OR
 2. Send mail using an SMTP server. Could you also point me to links showing
 installation / setting up of a SMTP server on Linux? The XAMPP docs say the
 Mercury mailserver is included, but I couldn't find any help for setting it
 up.
 OR
 3. Configuring the sendmail utility on Linux

 Alternaltly, any URLs giving the entire picture are also welcome. So far, I
 have only found info that is almost verbatim copy of the PHP manual. They
 just explain the different mail libraries and functions without considering
 the mail servers and all the back end.

 Thanks for taking the trouble to read!

 Regards,
 Ferdi


Easiest is (if you're on *nix) to setup an MTA like postfix or exim to
relay emails from the localhost. Then get a good mail library like
Swiftmailer and point that to the local MTA. Typically, that's about
the setup you need to do (if you keep things simple, that is: if you
want to mess about with postfix/exim you'll see days or months go by).

Regards
Peter


-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] Email from php

2010-05-19 Thread Ashley Sheridan
On Wed, 2010-05-19 at 16:57 +0530, Ferdi wrote:

 Hi List,
 
 I have met with little success sending mail from PHP. I have used mainly the
 mail() function but have also tried imap_mail() which the documentation says
 is just a wrapper around mail().
 
 Here is my understanding of the situation:
 On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
 smtp.someserver.com. I guess this works because the server I use relays all
 mail received; it does not check if the user has been registered or not. It
 obviously does not bother about the password.
 
 On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
 work. On Linux, what I have understood, is that the smtp server settings in
 php.ini do not matter. The sendmail / mail (something like that) utility is
 called which sends the mail. I have put in the correct sendmail_path setting
 in php.ini, but, I guess this utility is not configured since I don't
 receive the mail and running the code does not throw up errors or warnings.
 
 What I need to achieve is the ability to send attachments in an email from
 PHP. I would like one of the following options (in order of preference):
 
 1. Create an email account (specifically Google Apps Mail) and send email as
 that user. This will not be trivial. I will need to get a fix on
 authenticating, logging in etc.
 OR
 2. Send mail using an SMTP server. Could you also point me to links showing
 installation / setting up of a SMTP server on Linux? The XAMPP docs say the
 Mercury mailserver is included, but I couldn't find any help for setting it
 up.
 OR
 3. Configuring the sendmail utility on Linux
 
 Alternaltly, any URLs giving the entire picture are also welcome. So far, I
 have only found info that is almost verbatim copy of the PHP manual. They
 just explain the different mail libraries and functions without considering
 the mail servers and all the back end.
 
 Thanks for taking the trouble to read!
 
 Regards,
 Ferdi


Have you tried just sending mail directly from sendmail? If you can, see
if it gives any error messages there.

Also, try sending the email to several accounts, as the settings of one
email account may be marking the email as spam.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Email from php

2010-05-19 Thread Teus Benschop
On Wed, 2010-05-19 at 16:57 +0530, Ferdi wrote: 
 Hi List,
 
 I have met with little success sending mail from PHP. I have used mainly the
 mail() function but have also tried imap_mail() which the documentation says
 is just a wrapper around mail().
 
 Here is my understanding of the situation:
 On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
 smtp.someserver.com. I guess this works because the server I use relays all
 mail received; it does not check if the user has been registered or not. It
 obviously does not bother about the password.
 
 On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
 work. On Linux, what I have understood, is that the smtp server settings in
 php.ini do not matter. The sendmail / mail (something like that) utility is
 called which sends the mail. I have put in the correct sendmail_path setting
 in php.ini, but, I guess this utility is not configured since I don't
 receive the mail and running the code does not throw up errors or warnings.
 
 What I need to achieve is the ability to send attachments in an email from
 PHP. I would like one of the following options (in order of preference):
 
 1. Create an email account (specifically Google Apps Mail) and send email as
 that user. This will not be trivial. I will need to get a fix on
 authenticating, logging in etc.
 OR
 2. Send mail using an SMTP server. Could you also point me to links showing
 installation / setting up of a SMTP server on Linux? The XAMPP docs say the
 Mercury mailserver is included, but I couldn't find any help for setting it
 up.
 OR
 3. Configuring the sendmail utility on Linux
 

I believe that Zend_Mail would offer help here. It it a pure PHP
solution, and therefore should work on various operating systems.

Some code that uses Zend_Mail for sending out mail is at
git://git.savannah.nongnu.org/bibledit. See directory web/web in there.
We use smtp.gmail.com as the external SMTP server, and it works well.
Zend_Mail handles all authentication needed: SMTP: smtp.gmail.com, auth
= login, username = your_usern...@gmail.com, password =
YOUR_PASSWORD, ssl = ssl, port = 465.

Teus.





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



Re: [PHP] Email from php

2010-05-19 Thread Gary
Ferdi writes:

 I have met with little success sending mail from PHP. I have used mainly the
 mail() function but have also tried imap_mail() which the documentation says
 is just a wrapper around mail().

IMAP is only incoming (at least, the protocol is - the clue is in the
name Internet Message Access Protocol - I can't say anything about
imap_mail). I agree with others, the easiest solution is a local MTA
such as sendmail, or, preferably, something more simple.

 Here is my understanding of the situation:
 On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
 smtp.someserver.com. I guess this works because the server I use relays all
 mail received; it does not check if the user has been registered or
 not.

Oof. Yes, most remote/ISP MTAs these days will require some kind of
authentication, which is why it is best (IMO) to use a local MTA. It
won't mean you don't have to authenticate to the remote MTA, but it will
push the responsibility of configuring the MTA onto someone who knows
what it's all about.

 On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
 work. On Linux, what I have understood, is that the smtp server settings in
 php.ini do not matter. The sendmail / mail (something like that)

What happens if you type 'man mail'?

 utility is
 called which sends the mail. I have put in the correct sendmail_path setting
 in php.ini, but, I guess this utility is not configured since I don't
 receive the mail and running the code does not throw up errors or warnings.

You can try sending email from the commandline using 'mail' or even
sendmail, to see if it works.

You could try installing something simple locally (i.e. as your user),
perhaps msmtp, which is a piece of cake to setup, especially compared
with stuff like sendmail (which it is, anyway, compatible with, to a
large extent).

 What I need to achieve is the ability to send attachments in an email from
 PHP. I would like one of the following options (in order of preference):

 1. Create an email account (specifically Google Apps Mail) and send email as
 that user. This will not be trivial. I will need to get a fix on
 authenticating, logging in etc.

A simple config to send mail through Google Apps for Domains via a local
msmtp installation follows:
#--
defaults
host smtp.googlemail.com
tls on
tls_starttls on
port 587
tls_trust_file /home/YOUR_USER/.certs/equifax.pem
tls_cert_file
tls_key_file
auth on
logfile ~/.logfiles/msmtp.log

account foo
from f...@yourdomain
user f...@yourdomain
password YOUR_PASSWORD_HERE
#--

You'll need to get the referenced tls_trust_file but I forget where
from. It will be different anyway, depending on the system - for example
from looking at the msmtp docs it seems you can simply install a package
on Debian.

 3. Configuring the sendmail utility on Linux

From what I remember, I wouldn't recommend sendmail :) It's really
complicated, and probably overkill for what you want.

-- 
Gary

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



[PHP] Email with attachment

2010-05-15 Thread Php Developer
Hi,

I found a good function at php.net that sends email with atachment, but 
unfortunately i still cannot figure out how to send a body of the email too. 
Here is the code:

function sendEmailWithAttachement($to, $subject, $message, $file)
{
  if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol=\r\n;
  } 
  elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol=\r;
  }
  else 
  {
$eol=\n;
  } 
  $filename = basename($file);
  displaymessage($filename);
  $file_size = filesize($file);
  $file_type = filetype($file);
  displaymessage($file_size);
  $handle = fopen($file, rb);
  $content = fread($handle, $file_size);
  $content = chunk_split(base64_encode($content));
  fclose($handle);
  # Common Headers
$headers = 'From: cont...@example.com'.$eol;
$headers .= 'Reply-To: cont...@example.com'.$eol;
$headers .= 'Return-Path: cont...@example.com'.$eol; // these two to set 
reply address
$headers .= Message-ID: .time(). 
TheSystem@.$_SERVER['SERVER_NAME']..$eol;
$headers .= X-Mailer: PHP v.phpversion().$eol;   // These two to help 
avoid spam-filters
# Boundry for marking the split  Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= Content-Type: multipart/related; 
boundary=\.$mime_boundary.\.$eol;
$msg = ;

# Attachment
$msg .= --.$mime_boundary.$eol;
$msg .= Content-Type: .$file_type.; name=\.$filename.\.$eol;   // 
sometimes i have to send MS Word, use 'msword' instead of 'pdf'
$msg .= Content-Transfer-Encoding: base64.$eol;
$msg .= $message;
$msg .= Content-Disposition: attachment; 
filename=\.$filename.\.$eol.$eol; // !! This line needs TWO end of lines 
!! IMPORTANT !!
$msg .= $content.$eol.$eol;
# Setup for text OR html
$msg .= Content-Type: multipart/alternative.$eol;

# Text Version
$msg .= --.$mime_boundary.$eol;
$msg .= Content-Type: text/plain; charset=iso-8859-1.$eol;
$msg .= Content-Transfer-Encoding: 8bit.$eol;
$msg .= This is a multi-part message in MIME format..$eol;
$msg .= If you are reading this, please update your 
email-reading-software..$eol;
$msg .= + + Text Only + +.$eol.$eol; 

# Finished
$msg .= --.$mime_boundary.--.$eol.$eol;   // finish with two eol's for 
better security. see Injection.
mail($to, $subject, $msg, $headers);
}




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



Re: [PHP] Email with attachment

2010-05-15 Thread Jim Lucas

Php Developer wrote:

Hi,

I found a good function at php.net that sends email with atachment, but 
unfortunately i still cannot figure out how to send a body of the email too. 
Here is the code:

function sendEmailWithAttachement($to, $subject, $message, $file)
{
  if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol=\r\n;
  } 
  elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {

$eol=\r;
  }
  else 
  {

$eol=\n;
  } 
  $filename = basename($file);


What does the following do?  Does it echo something to the screen?


  displaymessage($filename);
  $file_size = filesize($file);
  $file_type = filetype($file);
  displaymessage($file_size);


Shouldn't you be checking to see if the file exists and is readable 
before you try opening it?



  $handle = fopen($file, rb);
  $content = fread($handle, $file_size);
  $content = chunk_split(base64_encode($content));


You should make sure ( strlen($content) !== 0 ) at this point.


  fclose($handle);
  # Common Headers
$headers = 'From: cont...@example.com'.$eol;
$headers .= 'Reply-To: cont...@example.com'.$eol;
$headers .= 'Return-Path: cont...@example.com'.$eol; // these two to set 
reply address
$headers .= Message-ID: .time(). 
TheSystem@.$_SERVER['SERVER_NAME']..$eol;
$headers .= X-Mailer: PHP v.phpversion().$eol;   // These two to help 
avoid spam-filters
# Boundry for marking the split  Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= Content-Type: multipart/related; 
boundary=\.$mime_boundary.\.$eol;
$msg = ;

# Attachment
$msg .= --.$mime_boundary.$eol;
$msg .= Content-Type: .$file_type.; name=\.$filename.\.$eol;   // 
sometimes i have to send MS Word, use 'msword' instead of 'pdf'
$msg .= Content-Transfer-Encoding: base64.$eol;
$msg .= $message;


Looks like you are missing some line endings on the above line.

Plus, why do the following lines require two EOL's but the above lines 
only use one EOL?



$msg .= Content-Disposition: attachment; 
filename=\.$filename.\.$eol.$eol; // !! This line needs TWO end of lines !! 
IMPORTANT !!
$msg .= $content.$eol.$eol;
# Setup for text OR html
$msg .= Content-Type: multipart/alternative.$eol;

# Text Version
$msg .= --.$mime_boundary.$eol;
$msg .= Content-Type: text/plain; charset=iso-8859-1.$eol;
$msg .= Content-Transfer-Encoding: 8bit.$eol;
$msg .= This is a multi-part message in MIME format..$eol;
$msg .= If you are reading this, please update your 
email-reading-software..$eol;
$msg .= + + Text Only + +.$eol.$eol; 


# Finished
$msg .= --.$mime_boundary.--.$eol.$eol;   // finish with two eol's for 
better security. see Injection.
mail($to, $subject, $msg, $headers);
}








--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



[PHP] Email security

2009-07-14 Thread Tiji varghese
Hello,

I've implemented a contact form on my website that would email me the contents 
of the form and also add it to the database. Its working perfectly but I'm not 
too sure about the security part. I don't know much about the security issues 
concerned with email forms and the measures to check it. Please help.

Thanks,
Tiji



  See the Web#39;s breaking stories, chosen by people like you. Check out 
Yahoo! Buzz. http://in.buzz.yahoo.com/

Re: [PHP] Email security

2009-07-14 Thread Eric Butera
On Tue, Jul 14, 2009 at 7:46 AM, Tiji varghesetij...@yahoo.co.in wrote:
 Hello,

 I've implemented a contact form on my website that would email me the 
 contents of the form and also add it to the database. Its working perfectly 
 but I'm not too sure about the security part. I don't know much about the 
 security issues concerned with email forms and the measures to check it. 
 Please help.

 Thanks,
 Tiji



      See the Web's breaking stories, chosen by people like you. Check out 
 Yahoo! Buzz. http://in.buzz.yahoo.com/


The main thing to be aware of would be 'email header injection.'  Do
not allow returns/newlines in any of the mail header fields you
populate from user input.  Also require a valid email address and
verify that it has a valid domain name.

Next up would just be the annoyance of a client receiving tons of spam
messages.  There are a lot of automated programs crawling the web just
filling out every form it finds looking for vulns to exploit.  Even if
your form has no holes in it, the client will still get all of this
unwanted junk from the automated tests.  You can try to come up with
some clever ways of stopping that.

-- 
http://www.ericbutera.us/

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



RE: [PHP] Email security

2009-07-14 Thread Dewey Williams

 -Original Message-
 From: Tiji varghese [mailto:tij...@yahoo.co.in]
 Sent: Tuesday, July 14, 2009 7:47 AM
 To: PHP General
 Subject: [PHP] Email security

 Hello,

 I've implemented a contact form on my website that would email me the
 contents of the form and also add it to the database. Its working
 perfectly but I'm not too sure about the security part. I don't know
 much about the security issues concerned with email forms and the
 measures to check it. Please help.

 Thanks,
 Tiji

[Dewey Williams]

There are a number of easy to use sanitizing scripts available for 
processing forms for email and database use - find and use one! Forms 
are notoriously easy to compromise for sending spam and corrupting web 
sites.


A program I have used in the past is FormMail by 
http://www.tectite.com.  There are many other FormMail programs 
available by the same name - this one is well documented and easy to set 
up.  It doesn't provide as much database security as you may want, but 
it does a good job of hiding email and preventing cross-site scripting 
attacks.


Dewey Williams


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



[PHP] PHP Email Setup problem

2009-05-14 Thread Moses
Hi Everyone

I have tried to configure my php.in file so as allow me to send email in PHP
from local server.
I added the lines in php.ini file
  sendmail_path = /usr/sbin/sendmail -t
  sendmail_from = n...@localhost

Therafter restarted my apache by:

sudo /etc/init.d/apache2 restart

However, I get the following error when I restart mt apache

  apache2: Could not reliably determine the server's fully qualified domain
name, using 12... for ServerName

Thanks.

Moses


Re: [PHP] PHP Email Setup problem

2009-05-14 Thread Shawn McKenzie
Moses wrote:
 Hi Everyone
 
 I have tried to configure my php.in file so as allow me to send email in PHP
 from local server.
 I added the lines in php.ini file
   sendmail_path = /usr/sbin/sendmail -t
   sendmail_from = n...@localhost
 
 Therafter restarted my apache by:
 
 sudo /etc/init.d/apache2 restart
 
 However, I get the following error when I restart mt apache
 
   apache2: Could not reliably determine the server's fully qualified domain
 name, using 12... for ServerName
 
 Thanks.
 
 Moses
 

That has nothing to do with PHP or sendmail, it's in the Apache conf.
You would see this whether you configured sendmail or not.  AFAIK it's
not a problem, especially on a dev box.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Email configuration

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 01:58 +, Nathan Rixham wrote:
 Shawn McKenzie wrote:
  Nathan Rixham wrote:
  Shawn McKenzie wrote:
  Ever heard of RBL or DNSBL?  I use it on my email server and so do many
  lol snap, just sent same message at same time - tis so easy to jump on
  ash's back cos he's always so sure he's right lolol
  
  Hmmm...  So Ashley is a him?
  
 
 yeah quot:
 Actually I'm a guy, but we can't all be perfect ;)
 http://www.mail-archive.com/php-general@lists.php.net/msg235765.html
 
 dunno why I insist on winding him up either, he's pretty sound lol
 
Thanks!

And yes, I just checked this morning, and I am still a guy! Bloody
Americans cannibalising the spelling of it for their girls!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Email configuration

2009-02-06 Thread Thodoris



2009/2/5 Thodoris t...@kinetix.gr:
  

I think that the OP mentioned the word fedora somewhere above...




Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
providers you'll need to use a relay. I found a nice tutorial about
how to set it up with google apps.
It was for Ubuntu but you just have to install msmtp and follow the other steps.
Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
I did it on my little gentoo server here at home and it works great.



  


Well if I am not getting what you say in the wrong way I should say that 
you don't need to use a relay because you don't need a mail server at all.
The point is that PHP can send mail with the mail() function using a 
local mail client like sendmail's client part or something coded in pure 
PHP.


Keep in mind that you don't need to have a mail server in your PC in 
order to send mail. Similarly PHP doesn't need to have a local mail 
server in order to send mail.


So you don't need extra mail configuration assuming of course that you 
don't need to do something extreme. You just use mail() and the mail 
gets sent.


--
Thodoris



Re: [PHP] Email configuration

2009-02-06 Thread Yannick Mortier
2009/2/6 Thodoris t...@kinetix.gr:

 2009/2/5 Thodoris t...@kinetix.gr:


 I think that the OP mentioned the word fedora somewhere above...



 Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
 providers you'll need to use a relay. I found a nice tutorial about
 how to set it up with google apps.
 It was for Ubuntu but you just have to install msmtp and follow the other
 steps.
 Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
 I did it on my little gentoo server here at home and it works great.





 Well if I am not getting what you say in the wrong way I should say that you
 don't need to use a relay because you don't need a mail server at all.
 The point is that PHP can send mail with the mail() function using a local
 mail client like sendmail's client part or something coded in pure PHP.

 Keep in mind that you don't need to have a mail server in your PC in order
 to send mail. Similarly PHP doesn't need to have a local mail server in
 order to send mail.

 So you don't need extra mail configuration assuming of course that you don't
 need to do something extreme. You just use mail() and the mail gets sent.

 --
 Thodoris


Of course he can send mails this way, but they won't be accepted by
many mail providers because of their anti-spam measurments.
They bounce mails that come from dynamic ip ranges like his home
server. I just wanted to help him avoid this because you won't see the
reason until you look at the syslog.



-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me at twitter!
http://twitter.com/moortier

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



Re: [PHP] Email configuration

2009-02-06 Thread Thodoris



2009/2/6 Thodoris t...@kinetix.gr:
  

2009/2/5 Thodoris t...@kinetix.gr:


I think that the OP mentioned the word fedora somewhere above...



Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
providers you'll need to use a relay. I found a nice tutorial about
how to set it up with google apps.
It was for Ubuntu but you just have to install msmtp and follow the other
steps.
Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
I did it on my little gentoo server here at home and it works great.





Well if I am not getting what you say in the wrong way I should say that you
don't need to use a relay because you don't need a mail server at all.
The point is that PHP can send mail with the mail() function using a local
mail client like sendmail's client part or something coded in pure PHP.

Keep in mind that you don't need to have a mail server in your PC in order
to send mail. Similarly PHP doesn't need to have a local mail server in
order to send mail.

So you don't need extra mail configuration assuming of course that you don't
need to do something extreme. You just use mail() and the mail gets sent.

--
Thodoris




Of course he can send mails this way, but they won't be accepted by
many mail providers because of their anti-spam measurments.
They bounce mails that come from dynamic ip ranges like his home
server. I just wanted to help him avoid this because you won't see the
reason until you look at the syslog.



  


I am sorry didn't get right what you meant after all.

In that case a simple mail() won't do.

--
Thodoris



Re: [PHP] Email configuration

2009-02-06 Thread Ashley Sheridan
On Fri, 2009-02-06 at 16:30 +0200, Thodoris wrote:
  2009/2/6 Thodoris t...@kinetix.gr:

  2009/2/5 Thodoris t...@kinetix.gr:
 
 
  I think that the OP mentioned the word fedora somewhere above...
 
 
 
  Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
  providers you'll need to use a relay. I found a nice tutorial about
  how to set it up with google apps.
  It was for Ubuntu but you just have to install msmtp and follow the other
  steps.
  Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
  I did it on my little gentoo server here at home and it works great.
 
 
 
 
 
  Well if I am not getting what you say in the wrong way I should say that 
  you
  don't need to use a relay because you don't need a 
 mail server at all.
  The point is that PHP can send mail with the mail() function using a local
  mail client like sendmail's client part or something coded in pure PHP.
 
  Keep in mind that you don't need to have a mail server in your PC in order
  to send mail. Similarly PHP doesn't need to have a local mail server in
  order to send mail.
 
  So you don't need extra mail configuration assuming of course that you 
  don't
  need to do something extreme. You just use mail() and the mail gets sent.
 
  --
  Thodoris
  
 
 
  Of course he can send mails this way, but they won't be accepted by
  many mail providers because of their anti-spam measurments.
  They bounce mails that come from dynamic ip ranges like his home
  server. I just wanted to help him avoid this because you won't see the
  reason until you look at the syslog.
 
 
 

  
 I am sorry didn't get right what you meant after all.
 
 In that case a simple mail() won't do.
 
I've never had an email bounced because of where it came from based on
IP. I have had emails bounced based on the email headers that were sent.
Always check the headers first. Even MessageLabs won't block an email
based on the IP.


Ash
www.ashleysheridan.co.uk



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



Re: [PHP] Email configuration

2009-02-06 Thread Shawn McKenzie
Ashley Sheridan wrote:
 On Fri, 2009-02-06 at 16:30 +0200, Thodoris wrote:
 2009/2/6 Thodoris t...@kinetix.gr:
   
 2009/2/5 Thodoris t...@kinetix.gr:


 I think that the OP mentioned the word fedora somewhere above...



 Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
 providers you'll need to use a relay. I found a nice tutorial about
 how to set it up with google apps.
 It was for Ubuntu but you just have to install msmtp and follow the other
 steps.
 Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
 I did it on my little gentoo server here at home and it works great.





 Well if I am not getting what you say in the wrong way I should say that 
 you
 don't need to use a relay because you don't need a 
 mail server at all.
 The point is that PHP can send mail with the mail() function using a local
 mail client like sendmail's client part or something coded in pure PHP.

 Keep in mind that you don't need to have a mail server in your PC in order
 to send mail. Similarly PHP doesn't need to have a local mail server in
 order to send mail.

 So you don't need extra mail configuration assuming of course that you 
 don't
 need to do something extreme. You just use mail() and the mail gets sent.

 --
 Thodoris
 

 Of course he can send mails this way, but they won't be accepted by
 many mail providers because of their anti-spam measurments.
 They bounce mails that come from dynamic ip ranges like his home
 server. I just wanted to help him avoid this because you won't see the
 reason until you look at the syslog.



   
  
 I am sorry didn't get right what you meant after all.

 In that case a simple mail() won't do.

 I've never had an email bounced because of where it came from based on
 IP. I have had emails bounced based on the email headers that were sent.
 Always check the headers first. Even MessageLabs won't block an email
 based on the IP.
 
 
 Ash
 www.ashleysheridan.co.uk
 
 
Ever heard of RBL or DNSBL?  I use it on my email server and so do many
others.  It checks the IP of the sending host against a list or set of
lists that contain addresses such as, known spammers, known open relays,
 blocks of IPs that are dynamic (used by ISPs for home customers), etc.
 If the sender is found in the list, the receiver terminates the
connection and doesn't even accept the email.

It's actually very slick.  I use the list at spamhaus.org.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Email configuration

2009-02-06 Thread Nathan Rixham

Ashley Sheridan wrote:

I've never had an email bounced because of where it came from based on
IP. I have had emails bounced based on the email headers that were sent.
Always check the headers first. Even MessageLabs won't block an email
based on the IP.



ash:
http://en.wikipedia.org/wiki/DNSBL
that's what RBL is, stopping email because of the IP it was sent from

if you've never had it then you can't be a spammer :D *hoorah*

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



Re: [PHP] Email configuration

2009-02-06 Thread Nathan Rixham

Shawn McKenzie wrote:

Ever heard of RBL or DNSBL?  I use it on my email server and so do many


lol snap, just sent same message at same time - tis so easy to jump on 
ash's back cos he's always so sure he's right lolol


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



Re: [PHP] Email configuration

2009-02-06 Thread Shawn McKenzie
Nathan Rixham wrote:
 Shawn McKenzie wrote:
 Ever heard of RBL or DNSBL?  I use it on my email server and so do many
 
 lol snap, just sent same message at same time - tis so easy to jump on
 ash's back cos he's always so sure he's right lolol

Hmmm...  So Ashley is a him?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Email configuration

2009-02-06 Thread Nathan Rixham

Shawn McKenzie wrote:

Nathan Rixham wrote:

Shawn McKenzie wrote:

Ever heard of RBL or DNSBL?  I use it on my email server and so do many

lol snap, just sent same message at same time - tis so easy to jump on
ash's back cos he's always so sure he's right lolol


Hmmm...  So Ashley is a him?



yeah quot:
Actually I'm a guy, but we can't all be perfect ;)
http://www.mail-archive.com/php-general@lists.php.net/msg235765.html

dunno why I insist on winding him up either, he's pretty sound lol

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



Re: [PHP] Email configuration

2009-02-06 Thread Ashley M. Kirchner

Nathan Rixham wrote:

Hmmm...  So Ashley is a him?



yeah quot:
Actually I'm a guy, but we can't all be perfect ;)
http://www.mail-archive.com/php-general@lists.php.net/msg235765.html
   Wouldn't be the first Ashley who's a guy.  I happen to be one of 
those too ...


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



[PHP] Email configuration

2009-02-05 Thread It flance
Hi all,

I've installed php and mysql in fedora. Now i am able to create php programs. 
But when I am unable to use email in my programs. I am wondering what is the 
easiest way to use email in my php programs. Can i send email from my personal 
computer. I am a regular person connected to internet through an internet 
provider.
Is there any preconfigured software or I have to go through the configuration 
of sendmail for example?

Thank you


  


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



Re: [PHP] Email configuration

2009-02-05 Thread Yannick Mortier
2009/2/5 It flance itmaqu...@yahoo.com:
 Hi all,

 I've installed php and mysql in fedora. Now i am able to create php programs. 
 But when I am unable to use email in my programs. I am wondering what is the 
 easiest way to use email in my php programs. Can i send email from my 
 personal computer. I am a regular person connected to internet through an 
 internet provider.
 Is there any preconfigured software or I have to go through the configuration 
 of sendmail for example?

 Thank you


Sorry... But I need a _little_ bit more information. What operating
system do you use? Linux/Windows/Mac/other?
The main problem is that most of the big email providers don't accept
mails from dialup connections, but there are solutions to work around
this. For now start by telling me which operating system you have.


-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me at twitter!
http://twitter.com/moortier

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



Re: [PHP] Email configuration

2009-02-05 Thread Thodoris



2009/2/5 It flance itmaqu...@yahoo.com:
  

Hi all,

I've installed php and mysql in fedora. Now i am able to create php programs. 
But when I am unable to use email in my programs. I am wondering what is the 
easiest way to use email in my php programs. Can i send email from my personal 
computer. I am a regular person connected to internet through an internet 
provider.
Is there any preconfigured software or I have to go through the configuration 
of sendmail for example?

Thank you




Sorry... But I need a _little_ bit more information. What operating
system do you use? Linux/Windows/Mac/other?
The main problem is that most of the big email providers don't accept
mails from dialup connections, but there are solutions to work around
this. For now start by telling me which operating system you have.


  


I think that the OP mentioned the word fedora somewhere above...

To the point:
Your linux probably has already installed the sendmail suite. If that is 
the case (run rpm -qa | grep sendmail to check) you may safely use the 
PHP's mail function for simple things. In case you don't have sendmail 
installed use:

# yum install sendmail

http://www.php.net/manual/en/function.mail.php

If you need more advanced features like for e.g. adding attachments to 
your e-mails you may consider other options like phpmailer. I have never 
used it myself but many people that belong in this gang are very fond of it.


http://phpmailer.codeworxtech.com/

Keep in mind that in case you have compiled PHP from source without 
having the sendmail installed you may need to recompile it. You can find 
this by making a phpinfo somewhere. In case you have installed from 
package no harm is done. Put this in a script:


?php
phpinfo();
?

You will find sendmail_path somethere in the resulting page or 
something like that Path to sendmail.

If this is set then everything will work like a charm.

--
Thodoris



Re: [PHP] Email configuration

2009-02-05 Thread Yannick Mortier
2009/2/5 Thodoris t...@kinetix.gr:

 I think that the OP mentioned the word fedora somewhere above...


Oh sorry, I'm so stupid... Anyways, if you want to send mail to large
providers you'll need to use a relay. I found a nice tutorial about
how to set it up with google apps.
It was for Ubuntu but you just have to install msmtp and follow the other steps.
Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail
I did it on my little gentoo server here at home and it works great.



-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me at twitter!
http://twitter.com/moortier

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



Re: [PHP] Email configuration

2009-02-05 Thread It flance
Thanks guys,

I'm gonna read all this staff, and let you know if have some issues.

Thanks a lot


--- On Thu, 2/5/09, Yannick Mortier mvmort...@googlemail.com wrote:

 From: Yannick Mortier mvmort...@googlemail.com
 Subject: Re: [PHP] Email configuration
 To: t...@kinetix.gr
 Cc: itmaqu...@yahoo.com, php-general@lists.php.net
 Date: Thursday, February 5, 2009, 3:19 PM
 2009/2/5 Thodoris t...@kinetix.gr:
 
  I think that the OP mentioned the word fedora
 somewhere above...
 
 
 Oh sorry, I'm so stupid... Anyways, if you want to send
 mail to large
 providers you'll need to use a relay. I found a nice
 tutorial about
 how to set it up with google apps.
 It was for Ubuntu but you just have to install msmtp and
 follow the other steps.
 Here it is:
 http://nanotux.com/blog/the-ultimate-server/4/#l-mail
 I did it on my little gentoo server here at home and it
 works great.
 
 
 
 -- 
 Currently developing a browsergame...
 http://www.p-game.de
 Trade - Expand - Fight
 
 Follow me at twitter!
 http://twitter.com/moortier
 
 -- 
 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] email app/script/needs...

2009-01-03 Thread bruce
HI...

Playing around with an app and I need to implement some functionality
allowing a user to email some text.

Basically, I want to allow the user to select some text from a dropdown
list. I then want to allow the user to edit the text if needed, and to then
submit the text for email to a given user. In order to perform some basic
QA, I want to have an additional user be notified of the email/text to be
sent, and to then have to authorize the email/text in order for it to be
sent.

The QA process is required as this is going to be part of a kind of stripped
down call center process.

I'm asking the list to see if anyone has come across this kind of
functionality in an app that you can point me to. I've been searching the
'net with no luck, and I'd rather not reinvent the wheel on this one..

Pointers/Comments appreciated!

Thanks!!!




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



Re: [PHP] Email Verification

2008-09-18 Thread Per Jessen
Lupus Michaelis wrote:

 Richard Heyes a écrit :
 
 New domain name extensions can be accounted for easily, eg:
 
 \.(?:[a-z]){2,4}
 
It excludes .museum tld.

Don't make assumptions about which TLDs that are or are not allowed -
the domain part of an email address could be validated with this:

@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+

A test for total length and valid use of hyphens should be added.  See
RFC1034.  Then look up the A record. 



/Per Jessen, Zürich


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



Re: [PHP] Email Verification

2008-09-18 Thread Andrew Ballard
On Thu, Sep 18, 2008 at 2:09 AM, Per Jessen [EMAIL PROTECTED] wrote:
 Lupus Michaelis wrote:

 Richard Heyes a écrit :

 New domain name extensions can be accounted for easily, eg:

 \.(?:[a-z]){2,4}

It excludes .museum tld.

 Don't make assumptions about which TLDs that are or are not allowed -
 the domain part of an email address could be validated with this:

 @[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+

 A test for total length and valid use of hyphens should be added.  See
 RFC1034.  Then look up the A record.



 /Per Jessen, Zürich


I don't know that it would add much benefit, but you could
periodically download a TLD list from IANA and compare that last
segment to the list.

Andrew


[PHP] Email Verification

2008-09-17 Thread Tom Chubb
Can anyone offer advice on best practices for email address verification?
Obviously for user registration it's common to click a link in your email to
complete the process thereby verifying the email, but if you want to keep
things very simple for the end user, what are the best methods?
I have been looking at getmxrr and the examples feature some good advice,
etc.
One that I've found that I'm thinking of using is
http://www.tienhuis.nl/php-email-address-validation-with-verify-probe which
tries to connect to the SMTP server as well as mx lookup, etc.
How reliable are these?
With new domain name extensions appearing all the time I wanted to find
something better than a regex which might become outdated after a while and
I'd never know about it!

Thoughts please and thanks in advance


Re: [PHP] Email Verification

2008-09-17 Thread Richard Heyes
 Can anyone offer advice on best practices for email address verification?
 Obviously for user registration it's common to click a link in your email to
 complete the process thereby verifying the email, but if you want to keep
 things very simple for the end user, what are the best methods?

The best method is that IMO. It's common place and thus understood.
There may be a delay incurred though because of mail delays.

 I have been looking at getmxrr and the examples feature some good advice,
 etc.
 One that I've found that I'm thinking of using is
 http://www.tienhuis.nl/php-email-address-validation-with-verify-probe which
 tries to connect to the SMTP server as well as mx lookup, etc.

You could. Bear in mind that you can't do that if their mail server
happens to be down at the time.

 How reliable are these?

Not 100%. Like I said, my preferred option would be just to send the
user an email.

 With new domain name extensions appearing all the time I wanted to find
 something better than a regex which might become outdated after a while and
 I'd never know about it!

New domain name extensions can be accounted for easily, eg:

\.(?:[a-z]){2,4}

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Email Verification

2008-09-17 Thread Per Jessen
Tom Chubb wrote:

 Can anyone offer advice on best practices for email address
 verification? 

1) check for a valid address syntax - that's easily done with a simply
regex (leaving the most obscure variations out). 
2) check that the domain-name exists and has an A record.



/Per Jessen, Zürich


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



Re: [PHP] Email Verification

2008-09-17 Thread Per Jessen
Richard Heyes wrote:

 I have been looking at getmxrr and the examples feature some good
 advice, etc.
 One that I've found that I'm thinking of using is
 http://www.tienhuis.nl/php-email-address-validation-with-verify-probe
 which tries to connect to the SMTP server as well as mx lookup, etc.
 
 You could. Bear in mind that you can't do that if their mail server
 happens to be down at the time.

Greylisting is also likely to interfer with the process.

 Like I said, my preferred option would be just to send the
 user an email.

I second that. 


/Per Jessen, Zürich


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



Re: [PHP] Email Verification

2008-09-17 Thread Stut

On 17 Sep 2008, at 14:20, Tom Chubb wrote:
Can anyone offer advice on best practices for email address  
verification?
Obviously for user registration it's common to click a link in your  
email to
complete the process thereby verifying the email, but if you want  
to keep

things very simple for the end user, what are the best methods?


Send them an email with a verification link - it's the only 100%  
accurate way and most people will have come across this requirement  
on other sites.


I have been looking at getmxrr and the examples feature some good  
advice,

etc.
One that I've found that I'm thinking of using is
http://www.tienhuis.nl/php-email-address-validation-with-verify- 
probe which

tries to connect to the SMTP server as well as mx lookup, etc.
How reliable are these?


They're not for reasons already mentioned by other posters. Also you  
need to consider how often you'll be doing this. I implemented this  
check on one of my sites and I very quickly hit auto-bans on Hotmail,  
Gmail and Yahoo mail servers. They don't like it when you make lots  
of connections to their servers without sending anything!


With new domain name extensions appearing all the time I wanted to  
find
something better than a regex which might become outdated after a  
while and

I'd never know about it!


In that case you need to make your regex loose enough to handle that,  
or keep on top of it manually. Either way you're better off just  
sending them a verification email.


-Stut

--
http://stut.net/

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



Re: [PHP] Email Verification

2008-09-17 Thread tedd

At 2:20 PM +0100 9/17/08, Tom Chubb wrote:

Can anyone offer advice on best practices for email address verification?
Obviously for user registration it's common to click a link in your email to
complete the process thereby verifying the email, but if you want to keep
things very simple for the end user, what are the best methods?
I have been looking at getmxrr and the examples feature some good advice,
etc.
One that I've found that I'm thinking of using is
http://www.tienhuis.nl/php-email-address-validation-with-verify-probe which
tries to connect to the SMTP server as well as mx lookup, etc.
How reliable are these?
With new domain name extensions appearing all the time I wanted to find
something better than a regex which might become outdated after a while and
I'd never know about it!

Thoughts please and thanks in advance


Tom:

To obtain a 100% valid email address you must take measures to 
validate it -- there are no short cuts.


Here's a working example I use for users posting comments (I'm still 
working on it):


http://sperling.com/comments/an-example/

The Explanation provides an explanation (what else?).

Plus, leaving a comment will show you how the process works.

One of the important points here is that this will only collect 
validated and willing email addresses.


Of course, the javascript routine to review email addresses after the 
user clicks submit will give the user a head's-up if the email 
address isn't properly formatted, but in the end the server-side must 
recheck everything anyway. So, JS in this case is just an example of 
progressive enhancement.


Cheers,

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] Email Verification

2008-09-17 Thread Lupus Michaelis

Richard Heyes a écrit :


New domain name extensions can be accounted for easily, eg:

\.(?:[a-z]){2,4}


  It excludes .museum tld.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



[PHP] Email - Best practice/advice please

2008-09-12 Thread Tom Chubb
I have generally been using the PHP mail function for sending emails from
contact forms on websites, but have recently had problems with a lot of
mails being delivered to junk/spam folders.
I've tried loads of different headers, etc and almost every contact form on
sites I've done is different.
I think it's time I started standardising and using an SMTP class to send
and wanted some advice from people.
I'm looking at the Pear Mail package and wondering whether that would be ok,
or should I just start rolling out phpmailer on all sites, in case I start
to put mailing lists, etc. in the future.
Basically, what do most of you do for contact/enquiry form emails?
TIA

Tom


Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Stut

On 12 Sep 2008, at 11:55, Tom Chubb wrote:
I have generally been using the PHP mail function for sending  
emails from
contact forms on websites, but have recently had problems with a  
lot of

mails being delivered to junk/spam folders.
I've tried loads of different headers, etc and almost every contact  
form on

sites I've done is different.
I think it's time I started standardising and using an SMTP class  
to send

and wanted some advice from people.
I'm looking at the Pear Mail package and wondering whether that  
would be ok,
or should I just start rolling out phpmailer on all sites, in case  
I start

to put mailing lists, etc. in the future.
Basically, what do most of you do for contact/enquiry form emails?


http://stut.net/blog/2008/06/18/sending-email/

-Stut

--
http://stut.net/

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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Aschwin Wesselius

Tom Chubb wrote:

I have generally been using the PHP mail function for sending emails from
contact forms on websites, but have recently had problems with a lot of
mails being delivered to junk/spam folders.
I've tried loads of different headers, etc and almost every contact form on
sites I've done is different.
I think it's time I started standardising and using an SMTP class to send
and wanted some advice from people.
I'm looking at the Pear Mail package and wondering whether that would be ok,
or should I just start rolling out phpmailer on all sites, in case I start
to put mailing lists, etc. in the future.
Basically, what do most of you do for contact/enquiry form emails?
TIA

Tom
  

Hi Tom,

Sorry to inform you about this. But it is a best practice (and my 
advice) to first search in any archive of a forum or mailinglist before 
asking a question regarding a subject.


Sending mail via a scripting language (like PHP) is a very common 
subject. Therefore an anwser to your question should be somewhere in the 
archives. I'm pretty sure the last month this topic has been started 2 
times.


So, I suggest that you first go about searching in the archives (of this 
mailinglist for example) and if you can't figure it out, you come back.

--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Tom Chubb
2008/9/12 Aschwin Wesselius [EMAIL PROTECTED]

   Tom Chubb wrote:

 I have generally been using the PHP mail function for sending emails from
 contact forms on websites, but have recently had problems with a lot of
 mails being delivered to junk/spam folders.
 I've tried loads of different headers, etc and almost every contact form on
 sites I've done is different.
 I think it's time I started standardising and using an SMTP class to send
 and wanted some advice from people.
 I'm looking at the Pear Mail package and wondering whether that would be ok,
 or should I just start rolling out phpmailer on all sites, in case I start
 to put mailing lists, etc. in the future.
 Basically, what do most of you do for contact/enquiry form emails?
 TIA

 Tom


 Hi Tom,

 Sorry to inform you about this. But it is a best practice (and my advice)
 to first search in any archive of a forum or mailinglist before asking a
 question regarding a subject.

 Sending mail via a scripting language (like PHP) is a very common subject.
 Therefore an anwser to your question should be somewhere in the archives.
 I'm pretty sure the last month this topic has been started 2 times.

 So, I suggest that you first go about searching in the archives (of this
 mailinglist for example) and if you can't figure it out, you come back.
 --

 Aschwin Wesselius

 *'What you would like to be done to you, do that to the other'*



Aschwin,
Thanks for your email. I do realise that and I read all messages through the
list, and always STFW and RTFM before posting. However every person's
requirements are different and I was asking for general personal opinions
rather than solutions to a specific application.
Obviously phpmailer is a very common solution as are Manuel Lemos' classes
but these might be overkill to use on simple 1 page sites that only require
a contact form.
We all know that the php mail function is pretty dire so I wanted to know
what most people do in their applications?
I'm not looking for someone to give me the code or anything so please don't
shoot me down! :)
Cheers,

Tom


Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Tom Chubb
2008/9/12 Stut [EMAIL PROTECTED]

  On 12 Sep 2008, at 11:55, Tom Chubb wrote:

 I have generally been using the PHP mail function for sending emails from
 contact forms on websites, but have recently had problems with a lot of
 mails being delivered to junk/spam folders.
 I've tried loads of different headers, etc and almost every contact form
 on
 sites I've done is different.
 I think it's time I started standardising and using an SMTP class to send
 and wanted some advice from people.
 I'm looking at the Pear Mail package and wondering whether that would be
 ok,
 or should I just start rolling out phpmailer on all sites, in case I start
 to put mailing lists, etc. in the future.
 Basically, what do most of you do for contact/enquiry form emails?


 http://stut.net/blog/2008/06/18/sending-email/

 -Stut

 --
 http://stut.net/


Thanks -Stut,
Very informative and I guessed what the first line would be before I clicked
the link...
If you're using PHP you want PHPMailer http://phpmailer.sf.net/.

:)


Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Per Jessen
Tom Chubb wrote:

 I have generally been using the PHP mail function for sending emails
 from contact forms on websites, but have recently had problems with a
 lot of mails being delivered to junk/spam folders.
 I've tried loads of different headers, etc and almost every contact
 form on sites I've done is different.
 I think it's time I started standardising and using an SMTP class to
 send and wanted some advice from people.
 I'm looking at the Pear Mail package and wondering whether that would
 be ok, or should I just start rolling out phpmailer on all sites, in
 case I start to put mailing lists, etc. in the future.
 Basically, what do most of you do for contact/enquiry form emails?

Tom, I think you're groping in the dark.  If your emails are ending up
in junk or spam folders, you need to investigate that in detail. 
How you generate your email is largely irrelevant and has little or no
bearing on whether it gets identified as spam or not. 

To answer your specific question, I use here-doc plus exec(sendmail). 


/Per Jessen, Zürich


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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Richard Heyes
 I use here-doc plus exec(sendmail).

Why?

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Per Jessen
Richard Heyes wrote:

 I use here-doc plus exec(sendmail).
 
 Why?

Using heredocs is probably habit, but it's also easy, and I like keeping
the email template in the code.  I use exec(sendmail) because it allows
me to set the Return-Path.

For purely internal stuff, I just as often use plain mail().


/Per Jessen, Zürich


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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Richard Heyes
  I use exec(sendmail) because it allows
 me to set the Return-Path.

mail() does too.

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Per Jessen
Richard Heyes wrote:

  I use exec(sendmail) because it allows
 me to set the Return-Path.
 
 mail() does too.
 

In additional-parameters?  Yeah, I think I knew that, but for some
reason I haven't been using it.  I don't think it works in safe-mode or
something like that.  Or maybe it doesn't work in older (4.3,4.4)
versions?  


/Per Jessen, Zürich


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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread Richard Heyes
 In additional-parameters?  Yeah, I think I knew that, but for some
 reason I haven't been using it.  I don't think it works in safe-mode or
 something like that.  Or maybe it doesn't work in older (4.3,4.4)
 versions?

Dunno, it's been over 4 1/2 years since I used PHP4.

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread tedd

At 12:03 PM +0100 9/12/08, Stut wrote:

On 12 Sep 2008, at 11:55, Tom Chubb wrote:

I have generally been using the PHP mail function for sending emails from
contact forms on websites, but have recently had problems with a lot of
mails being delivered to junk/spam folders.
I've tried loads of different headers, etc and almost every contact form on
sites I've done is different.
I think it's time I started standardising and using an SMTP class to send
and wanted some advice from people.
I'm looking at the Pear Mail package and wondering whether that would be ok,
or should I just start rolling out phpmailer on all sites, in case I start
to put mailing lists, etc. in the future.
Basically, what do most of you do for contact/enquiry form emails?


http://stut.net/blog/2008/06/18/sending-email/

-Stut


-Stut:

There you go again with your excellent, but damned annoying, 
articles. Please provide questionable advice every once in a while. 
:-)


Cheers,

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] Email - Best practice/advice please

2008-09-12 Thread tedd

At 2:57 PM +0200 9/12/08, Per Jessen wrote:

Richard Heyes wrote:


 I use here-doc plus exec(sendmail).


 Why?


Using heredocs is probably habit, but it's also easy, and I like keeping
the email template in the code.  I use exec(sendmail) because it allows
me to set the Return-Path.

For purely internal stuff, I just as often use plain mail().

/Per Jessen, Zürich


I've never used exec, but I often use both 
heredocs and mail() for sending template emails. 
I just haven't used them for sending mass email.


But then again I don't know what defines mass 
anyway. Is mass  100,  1000, or what?


Cheers,

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] Email - Best practice/advice please

2008-09-12 Thread Stut

On 12 Sep 2008, at 18:00, tedd wrote:

At 12:03 PM +0100 9/12/08, Stut wrote:

On 12 Sep 2008, at 11:55, Tom Chubb wrote:
I have generally been using the PHP mail function for sending  
emails from
contact forms on websites, but have recently had problems with a  
lot of

mails being delivered to junk/spam folders.
I've tried loads of different headers, etc and almost every  
contact form on

sites I've done is different.
I think it's time I started standardising and using an SMTP class  
to send

and wanted some advice from people.
I'm looking at the Pear Mail package and wondering whether that  
would be ok,
or should I just start rolling out phpmailer on all sites, in case  
I start

to put mailing lists, etc. in the future.
Basically, what do most of you do for contact/enquiry form emails?


http://stut.net/blog/2008/06/18/sending-email/

-Stut


-Stut:

There you go again with your excellent, but damned annoying,  
articles. Please provide questionable advice every once in a  
while. :-)


Chain saws make excellent playthings for 4 year olds*.

-Stut

* For those who read the warnings on toothpick packets, I'm only  
joking. Please do not give a chain saw to a child of any age. Ever! ;)


--
http://stut.net/

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



Re: [PHP] Email - Best practice/advice please

2008-09-12 Thread tedd

At 6:47 PM +0100 9/12/08, Stut wrote:


Chain saws make excellent playthings for 4 year olds*.

-Stut


Believe it or not, but when I was first introduced to my grand 
father, he gave me a baby rattlesnake to play with. My mother was 
horrified when she found out some time later and took it away -- a 
true story.


Cheers,

tedd

PS: My grand father was also immune to rattlesnake bites.

--
---
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] PHP email

2008-07-31 Thread Richard Heyes
Hi,

Can someone tell me what the address is to change my @php.net redirect? Thanks.

-- 
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 email

2008-07-31 Thread Daniel Brown
On Thu, Jul 31, 2008 at 7:46 AM, Richard Heyes [EMAIL PROTECTED] wrote:
 Hi,

 Can someone tell me what the address is to change my @php.net redirect? 
 Thanks.

It's on the Master system.  I'll send you the direct link to edit
your profile in a Google chat.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] email issue

2008-03-14 Thread nihilism machine

here is my simple email lib: http://pastebin.com/m4d107c01

any idea why in the body i have a link with an = sign that gets  
replaced with a % sign?


-e

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



Re: [PHP] email issue

2008-03-14 Thread Børge Holen
On Friday 14 March 2008 18:33:13 nihilism machine wrote:
 here is my simple email lib: http://pastebin.com/m4d107c01

 any idea why in the body i have a link with an = sign that gets
 replaced with a % sign?

 -e

read up on urlencode

-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] email with style (again)

2008-02-27 Thread Daniel Brown
On Tue, Feb 26, 2008 at 8:33 PM, tedd [EMAIL PROTECTED] wrote:
 Ok gang:

  What's wrong with the following code?
[snip!]

The placement was wrong with the content-type info, that's all.
It should be in the headers, after your from/x-mailer/blah/blah/blah
envelope information.  Also, when starting a long string, the first
entry doesn't need to be dotted.  In fact, if that variable was
elsewhere populated already, you'll append on to that, rather than
re-instantiating the variable.  Of course, there's also HEREDOC to
consider but that's for a different email.  Here's the reworked
(and working - tested and all) code:

// Common Headers
$headers  = From: .$fromname..$fromaddress..$eol;
$headers .= Reply-To: .$fromname..$fromaddress..$eol;
$headers .= Return-Path: .$fromname..$fromaddress..$eol;
$headers .= Message-ID: .time().-.$fromaddress..$eol;
$headers .= X-Mailer: PHP v.phpversion().$eol;

// HTML Version
$headers .= Content-Type: text/html; charset=iso-8859-1.$eol;
$headers .= Content-Transfer-Encoding: 8bit.$eol.$eol;
$msg = $body.$eol.$eol;

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] email with style (again)

2008-02-26 Thread tedd

Ok gang:

What's wrong with the following code?

It sends the email OK, but nothing is styled.

Where did I go wrong?

Thanks,

tedd

--- code

?php

$to = [EMAIL PROTECTED];
$body = make_mail();
$subject = Subject;
$fromaddress = [EMAIL PROTECTED];
$fromname = tedd;

send_mail($to, $body, $subject, $fromaddress, $fromname, $attachments=false);

echo('Email sent');

?


?php

function make_mail()
{
$message = EOT

span style=font-weight: bold;Title:/span A title of something
span style=font-weight: bold;Presenter:/span By someone

tedd

EOT;
return $message;
}

function send_mail($to, $body, $subject, $fromaddress, $fromname, 
$attachments=false)

{
$eol=\r\n;

// Common Headers
$headers .= From: .$fromname..$fromaddress..$eol;
$headers .= Reply-To: .$fromname..$fromaddress..$eol;
$headers .= Return-Path: .$fromname..$fromaddress..$eol;
$headers .= Message-ID: .time().-.$fromaddress..$eol;
$headers .= X-Mailer: PHP v.phpversion().$eol;

// HTML Version
$msg .= Content-Type: text/html; charset=iso-8859-1.$eol;
$msg .= Content-Transfer-Encoding: 8bit.$eol.$eol;
$msg .= $body.$eol.$eol;

// SEND THE EMAIL
ini_set(sendmail_from,$fromaddress);
$mail_sent = mail($to, $subject, $msg, $headers);

ini_restore(sendmail_from);

return $mail_sent;
}
?
--
---
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] email with style (again)

2008-02-26 Thread Andrés Robinet
 -Original Message-
 From: tedd [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 26, 2008 8:33 PM
 To: php-general@lists.php.net
 Subject: [PHP] email with style (again)
 
 Ok gang:
 
 What's wrong with the following code?
 
 It sends the email OK, but nothing is styled.
 
 Where did I go wrong?
 
 Thanks,
 
 tedd
 
 --- code
 
 ?php
 
 $to = [EMAIL PROTECTED];
 $body = make_mail();
 $subject = Subject;
 $fromaddress = [EMAIL PROTECTED];
 $fromname = tedd;
 
 send_mail($to, $body, $subject, $fromaddress, $fromname,
 $attachments=false);
 
 echo('Email sent');
 
 ?
 
 
 ?php
 
 function make_mail()
 {
 $message = EOT
 
 span style=font-weight: bold;Title:/span A title of something
 span style=font-weight: bold;Presenter:/span By someone
 
 tedd
 
 EOT;
 return $message;
 }
 
 function send_mail($to, $body, $subject, $fromaddress, $fromname,
 $attachments=false)
 {
 $eol=\r\n;
 
 // Common Headers
 $headers .= From: .$fromname..$fromaddress..$eol;
 $headers .= Reply-To: .$fromname..$fromaddress..$eol;
 $headers .= Return-Path: .$fromname..$fromaddress..$eol;
 $headers .= Message-ID: .time().-.$fromaddress..$eol;
 $headers .= X-Mailer: PHP v.phpversion().$eol;
 
 // HTML Version
 $msg .= Content-Type: text/html; charset=iso-8859-1.$eol;
 $msg .= Content-Transfer-Encoding: 8bit.$eol.$eol;
 $msg .= $body.$eol.$eol;

Shouldn't this be added?
$msg .= MIME-Version: 1.0.$eol;
...

And, actually, shouldn't this be placed in the $headers variable? Like:

$headers = MIME-Version: 1.0.$eol;
$headers .= Content-Type: text/html; charset=iso-8859-1.$eol;
$headers .= Content-Transfer-Encoding: 8bit.$eol.$eol;
$headers .= From: .$fromname..$fromaddress..$eol;
$headers .= Reply-To: .$fromname..$fromaddress..$eol;
$headers .= Return-Path: .$fromname..$fromaddress..$eol;
$headers .= Message-ID: .time().-.$fromaddress..$eol;
$headers .= X-Mailer: PHP v.phpversion(); // I REMOVED THE LAST $eol, IS IT
NECESSARY???

$msg .= $body.$eol.$eol;
...

 
 // SEND THE EMAIL
 ini_set(sendmail_from,$fromaddress);
 $mail_sent = mail($to, $subject, $msg, $headers);
 
 ini_restore(sendmail_from);
 
 return $mail_sent;
 }
 ?
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 
 --

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



[PHP] [EMAIL PROTECTED]

2008-01-24 Thread Marek Zdybel

-- 
Fotograf Ślubny
http://mzdybel.pl
tel. 607 825 735
gg:4203195
skype: marek.zdybel

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



[PHP] email authentication

2007-12-22 Thread Afan Pasalic

Hi,
I have to develop a little registration form.
after the form is submitted confirmation email has to be sent to registrant.

I use this function to send an email:

function send_plain_email($to, $subject, $body)
{
	$headers =MIME-Versin: 1.0\n . Content-type: text/plain; 
charset=ISO-8859-1; format=flowed\n . Content-Transfer-Encoding: 8bit\n .

Reply-To: Registration [EMAIL PROTECTED]\n.
From: Registration [EMAIL PROTECTED]\n .
X-Mailer: PHP . phpversion();   

mail($to, $subject, $body, $headers) or die(mysql_errno());
}

Though, I'm getting the following error:

Warning: mail() [function.mail]: SMTP server response: 503 This mail 
server requires authentication when attempting to send to a non-local 
e-mail address. Please check your mail client settings or contact your 
administrator to verify that the domain or address is defined for this 
server. in 
D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34


Never get such a error using LAMP.

Thanks for any help,
-afan

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



Re: [PHP] email authentication

2007-12-22 Thread Stut

Afan Pasalic wrote:

I have to develop a little registration form.
after the form is submitted confirmation email has to be sent to 
registrant.


I use this function to send an email:

function send_plain_email($to, $subject, $body)
{
$headers =MIME-Versin: 1.0\n . Content-type: text/plain; 
charset=ISO-8859-1; format=flowed\n . Content-Transfer-Encoding: 
8bit\n .

Reply-To: Registration [EMAIL PROTECTED]\n.
From: Registration [EMAIL PROTECTED]\n .
X-Mailer: PHP . phpversion();   

mail($to, $subject, $body, $headers) or die(mysql_errno());

}

Though, I'm getting the following error:

Warning: mail() [function.mail]: SMTP server response: 503 This mail 
server requires authentication when attempting to send to a non-local 
e-mail address. Please check your mail client settings or contact your 
administrator to verify that the domain or address is defined for this 
server. in 
D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34


Never get such a error using LAMP.


I'm assuming from that comment that you're running this under Windows of 
some variety? This is not a PHP problem. The mail server PHP is 
configured to use (see php.ini) requires authentication. The built-in 
mail function doesn't support that so you'll need to use something like 
PHPMailer (Google for it).


-Stut

--
http://stut.net/

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



[PHP] Email question

2007-10-31 Thread Jake
What is a =20 at the end of a line in an email? Is it some kind of whitespace 
line return or something? it only seems to appear when there is whitespace that 
is linewrapping. I have googled and googled for it, but havn't found anything 
yet. here's my function...

buffer is a complete correctly formatted email from any standard client.

In most of my tests, everything works fine, but a test with many spaces trying 
to wrap them, it gives a =20 in the email result.

It's probably simple.. sitting here too long and its halloween!!

Thanks,
Jake


function parseEmail($buffer)
{
  $pattern1 = '/^From: \(.*)\ (.*)\@(.*)\.(.*)/';
  $pattern2 = '/^From: (.*)\@(.*)\.(.*)/';
  $pattern3 = '/^Subject: (.*)/';

  $pattern4 = 'Content-Type: text/plain;';
  $pattern5 = 'Content-Type: text/html;';

  $temp = explode(\n, $buffer);
  foreach($temp as $key = $value)
  {
if (preg_match($pattern1, $value, $match))
{
  $from = \$match[1]\ [EMAIL PROTECTED];
}
else if (preg_match($pattern2, $value, $match))
{
  $from = \\ [EMAIL PROTECTED];
}

if (preg_match($pattern3, $value, $match))
{
  $subject = $match[1];
}

if ($pos = strpos($value, $pattern4) !== false)
{
  $begin = $key;
}

if ($pos = strpos($value, $pattern5) !== false)
{
  $end = $key - 1;
}
  }

  if (!isset($end))
  {
$end = count($temp) - 1;
  }

  $data = Below is the email you sent to [EMAIL PROTECTED]:\n\n;
  $start = 'false';

  while($begin  $end)
  {
if ($start == 'false')
{
  if (empty($temp[$begin]))
  {
$start = 'true';
  }
}
else
{
  $data .= chop($temp[$begin]) . \n;
}
$begin++;
  }
  return $from|$subject|$data;
}


  1   2   3   4   5   6   >