keyongtech


  keyongtech > php > 09/2008

 #1  
09-12-08, 11:55 AM
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
 #2  
09-12-08, 12:03 PM
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
 #3  
09-12-08, 12:07 PM
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.
 #4  
09-12-08, 12:20 PM
Tom Chubb
2008/9/12 Aschwin Wesselius <aschwin>

[..]
> 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
 #5  
09-12-08, 12:22 PM
Tom Chubb
2008/9/12 Stut <stuttle>

> On 12 Sep 2008, at 11:55, Tom Chubb wrote:
>> [..]

>
> -Stut
>
> --
> [..]
>


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

:)
 #6  
09-12-08, 01:26 PM
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
 #7  
09-12-08, 01:35 PM
Richard Heyes
> I use here-doc plus exec(sendmail).

Why?
 #8  
09-12-08, 01:57 PM
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
 #9  
09-12-08, 02:00 PM
Richard Heyes
> I use exec(sendmail) because it allows
> me to set the Return-Path.


mail() does too.
 #10  
09-12-08, 02:14 PM
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
 #11  
09-12-08, 02:52 PM
Ross McKay
On Fri, 12 Sep 2008 11:55:03 +0100, 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. [...]


If you don't end up using PHPMailer, make sure that you are setting
these fields properly or SpamAssassin et al will suspect your emails as
being SPAM.

From: a valid (looking) email address
Date: the send date in RFC-2822 format, date('r')
Message-ID: <some unique ID>
Content-Type: whatever is appropriate for your email (e.g. text/plain)

Good idea:
X-Mailer: 'PHP/' . phpversion()

To test, send some emails to yourself at an account that has
SpamAssassin and look at the headers to see what SpamAssassin says as it
should indicate what it doesn't like about your emails. Try this first,
before messing with the headers above.
 #12  
09-12-08, 03:05 PM
Tom Chubb
2008/9/12 Ross McKay <rosko>

[..]
> before messing with the headers above.
> --
> Ross McKay, Toronto, NSW Australia
> "You can't have egg bacon spam and sausage without the spam." - Pythons
>
> --
> PHP General Mailing List ([..])
> To unsubscribe, visit: [..]
>

Thanks Ross,
I have read somewhere before about creating a message id with the date&time
and a random number.
Still I think I'm going to be ending up down the phpmailer route!
T
 #13  
09-12-08, 04:46 PM
Al
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
>


I use Pear Mail, just because it's easy.

And since using DomainKeys and SPF, I've not had any receiving servers, at least that I know of,
mistake my emails as SPAM
 #14  
09-12-08, 05:59 PM
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.
 #15  
09-12-08, 06:00 PM
tedd
At 12:03 PM +0100 9/12/08, Stut wrote:
>On 12 Sep 2008, at 11:55, Tom Chubb wrote:
>
>[..]
>
>-Stut


-Stut:

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

Cheers,

tedd

Similar Threads
GPO, OU and best practice and advice

Presently I have my OU setup per work areas: Managers Accountants Sales Tech Some of the techs and sales people are remote (laptops), some are local (desktops), and some...

Advice on the best practice please...

Guys, I would like to write a error handler, or something, that will allow me to write to a database when an error occurs on my site. I am trying to implement this in the...

Best practice advice please!

We currently have 1 server in place in our domain which runs everything we need. It's our file server, domain controller etc etc... We do have two issues though and they...

Best Practice Advice XML

Hi, I'm needing to update an xml file by inserting a new node. First I need to load the xml into a XmlDocument from file. In the first run, the file won't exist and I will...

COM / DCCOM - Best practice advice

Hi all, I havent used COM or DCOM yet so am looking for some best practice advice before I do. I understand a COM .EXE server will retain a reference count of the number of...


All times are GMT. The time now is 08:15 PM. | Privacy Policy