f



PHP Mail

Hi,

In this application the PHP scripts are running on one server, but the
postfix server is a different machine.  I tried this Pear mail and
although it does send using a report SMTP server there are a few
things that I cannot seem to do:

- Cannot seem to alter headers to send HTML email
- Recipient always has email appear as "undisclosed-recipients"

Can anyone help?  Is there a better / easier way to do this?  We need
to send HTML emails.  We tried PHPMailer and could not get it to work
at all, so, we are looking for another suggestion.

Thanks!
0
The
11/20/2010 11:22:52 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

8 Replies
787 Views

Similar Articles

[PageSpeed] 14

The Magnet wrote:
> Hi,
> 
> In this application the PHP scripts are running on one server, but the
> postfix server is a different machine.  I tried this Pear mail and
> although it does send using a report SMTP server there are a few
> things that I cannot seem to do:
> 
> - Cannot seem to alter headers to send HTML email
> - Recipient always has email appear as "undisclosed-recipients"
> 
> Can anyone help?  Is there a better / easier way to do this?  We need
> to send HTML emails.  We tried PHPMailer and could not get it to work
> at all, so, we are looking for another suggestion.
> 
> Thanks!
I just use whatever  it is that's the standard php library.

Works fine..BUT what platform are you in..you should have SOME kind of 
local mail transport surely?

0
The
11/21/2010 12:52:15 AM
On 11/20/2010 6:22 PM, The Magnet wrote:
> Hi,
>
> In this application the PHP scripts are running on one server, but the
> postfix server is a different machine.  I tried this Pear mail and
> although it does send using a report SMTP server there are a few
> things that I cannot seem to do:
>
> - Cannot seem to alter headers to send HTML email
> - Recipient always has email appear as "undisclosed-recipients"
>
> Can anyone help?  Is there a better / easier way to do this?  We need
> to send HTML emails.  We tried PHPMailer and could not get it to work
> at all, so, we are looking for another suggestion.
>
> Thanks!

I would suggest you find out why PHPMailer won't work.  It's by far the 
best mailer program around.

I never used Pear mail because PHPMailer is so much better.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Jerry
11/21/2010 1:29:29 AM
The Magnet wrote:
> Hi,
> 
> In this application the PHP scripts are running on one server, but the
> postfix server is a different machine.  I tried this Pear mail and
> although it does send using a report SMTP server there are a few
> things that I cannot seem to do:
> 
> - Cannot seem to alter headers to send HTML email
> - Recipient always has email appear as "undisclosed-recipients"
> 
> Can anyone help?  Is there a better / easier way to do this?  We need
> to send HTML emails.  We tried PHPMailer and could not get it to work
> at all, so, we are looking for another suggestion.
> 
> Thanks!

Most of these extra mail libraries are overkill. Did you look at the PHP 
site documentation for the mail() function? There are some examples 
(perhaps contributed by 3rd parties) which show you how to send HTML 
emails. If you always use the same format, i.e. maybe with no additional 
attachments, it is pretty simple to roll your own function using the 
mail() function.

Also, it is a good idea to read the RFC docs referenced in the PHP site 
to understand what is going on WRT email headers.
0
Robert
11/21/2010 12:39:06 PM
Robert Hairgrove wrote:
> The Magnet wrote:
>> Hi,
>>
>> In this application the PHP scripts are running on one server, but the
>> postfix server is a different machine.  I tried this Pear mail and
>> although it does send using a report SMTP server there are a few
>> things that I cannot seem to do:
>>
>> - Cannot seem to alter headers to send HTML email
>> - Recipient always has email appear as "undisclosed-recipients"
>>
>> Can anyone help?  Is there a better / easier way to do this?  We need
>> to send HTML emails.  We tried PHPMailer and could not get it to work
>> at all, so, we are looking for another suggestion.
>>
>> Thanks!
> 
> Most of these extra mail libraries are overkill. Did you look at the PHP 
> site documentation for the mail() function? There are some examples 
> (perhaps contributed by 3rd parties) which show you how to send HTML 
> emails. If you always use the same format, i.e. maybe with no additional 
> attachments, it is pretty simple to roll your own function using the 
> mail() function.
> 
> Also, it is a good idea to read the RFC docs referenced in the PHP site 
> to understand what is going on WRT email headers.

yes. php's mail functions is entirely adequate. But it will invoke the 
local sendmail on the local machine: So that must needs be set up.

If its on linux, exim or postfix are relatively simple to configure.


IIRC on windows you have the option to forward to a smart host.

0
The
11/21/2010 4:15:12 PM
..oO(Robert Hairgrove)

>The Magnet wrote:
>> Hi,
>> 
>> In this application the PHP scripts are running on one server, but the
>> postfix server is a different machine.  I tried this Pear mail and
>> although it does send using a report SMTP server there are a few
>> things that I cannot seem to do:
>> 
>> - Cannot seem to alter headers to send HTML email
>> - Recipient always has email appear as "undisclosed-recipients"
>> 
>> Can anyone help?  Is there a better / easier way to do this?  We need
>> to send HTML emails.  We tried PHPMailer and could not get it to work
>> at all, so, we are looking for another suggestion.

It might help to say what "could not get it to work" means. Such a
simple "doesn't work" is no error description and hence pretty useless.

>Most of these extra mail libraries are overkill.

Not really.

>Did you look at the PHP 
>site documentation for the mail() function?

If you have a reliable mailer class, you really don't want to use the
mail() function anymore. Especially creating MIME meassages by hand is
just nonsense, error-prone and too much work.

>There are some examples 
>(perhaps contributed by 3rd parties) which show you how to send HTML 
>emails. If you always use the same format, i.e. maybe with no additional 
>attachments, it is pretty simple to roll your own function using the 
>mail() function.

With a good class it's even simpler and much more reliable:

$mail = new Mail(…);
$mail->addAddress(…);
$mail->addAttachment(…);
$mail->send();

Something like that.

>Also, it is a good idea to read the RFC docs referenced in the PHP site 
>to understand what is going on WRT email headers.

A good class takes care of all those things, including prevention of
header injection, which is often forgotten when using mail().

Micha
0
Michael
11/21/2010 6:02:08 PM
On Nov 21, 12:02=A0pm, Michael Fesser <neti...@gmx.de> wrote:
> .oO(Robert Hairgrove)
>
> >The Magnet wrote:
> >> Hi,
>
> >> In this application the PHP scripts are running on one server, but the
> >> postfix server is a different machine. =A0I tried this Pear mail and
> >> although it does send using a report SMTP server there are a few
> >> things that I cannot seem to do:
>
> >> - Cannot seem to alter headers to send HTML email
> >> - Recipient always has email appear as "undisclosed-recipients"
>
> >> Can anyone help? =A0Is there a better / easier way to do this? =A0We n=
eed
> >> to send HTML emails. =A0We tried PHPMailer and could not get it to wor=
k
> >> at all, so, we are looking for another suggestion.
>
> It might help to say what "could not get it to work" means. Such a
> simple "doesn't work" is no error description and hence pretty useless.
>
> >Most of these extra mail libraries are overkill.
>
> Not really.
>
> >Did you look at the PHP
> >site documentation for the mail() function?
>
> If you have a reliable mailer class, you really don't want to use the
> mail() function anymore. Especially creating MIME meassages by hand is
> just nonsense, error-prone and too much work.
>
> >There are some examples
> >(perhaps contributed by 3rd parties) which show you how to send HTML
> >emails. If you always use the same format, i.e. maybe with no additional
> >attachments, it is pretty simple to roll your own function using the
> >mail() function.
>
> With a good class it's even simpler and much more reliable:
>
> $mail =3D new Mail(=85);
> $mail->addAddress(=85);
> $mail->addAttachment(=85);
> $mail->send();
>
> Something like that.
>
> >Also, it is a good idea to read the RFC docs referenced in the PHP site
> >to understand what is going on WRT email headers.
>
> A good class takes care of all those things, including prevention of
> header injection, which is often forgotten when using mail().
>
> Micha


I'm sorry, I should have been more detailed.  I am running CentOS
5.x.  We were using mail(), but now since Postfix is on the other
server, I need to find a way to have it use that server.

With PHPMailer, there was some sort of class file which I could not
find and could not get the procedure working.  I cannot explain it,
just the call did not do anything.If you have an example of how
PHPMailer is used or where I can go to see one, and get a complete
copy of it, because the copies I downloaded were always missing some
class.xxxxxxx.xxxxx  file.

Thanks you a lot.


0
The
11/21/2010 8:38:08 PM
In article <r8nie6p5ptapovc8evqqe1ihbsh1bfj3gg@mfesser.de>,
 Michael Fesser <netizen@gmx.de> wrote:

> .oO(Robert Hairgrove)
> 
> >The Magnet wrote:
> >> Hi,
> >> 
> >> In this application the PHP scripts are running on one server, but the
> >> postfix server is a different machine.  I tried this Pear mail and
> >> although it does send using a report SMTP server there are a few
> >> things that I cannot seem to do:
> >> 
> >> - Cannot seem to alter headers to send HTML email
> >> - Recipient always has email appear as "undisclosed-recipients"
> >> 
> >> Can anyone help?  Is there a better / easier way to do this?  We need
> >> to send HTML emails.  We tried PHPMailer and could not get it to work
> >> at all, so, we are looking for another suggestion.
> 
> It might help to say what "could not get it to work" means. Such a
> simple "doesn't work" is no error description and hence pretty useless.
> 
> >Most of these extra mail libraries are overkill.
> 
> Not really.
> 
> >Did you look at the PHP 
> >site documentation for the mail() function?
> 
> If you have a reliable mailer class, you really don't want to use the
> mail() function anymore. Especially creating MIME meassages by hand is
> just nonsense, error-prone and too much work.
> 
> >There are some examples 
> >(perhaps contributed by 3rd parties) which show you how to send HTML 
> >emails. If you always use the same format, i.e. maybe with no additional 
> >attachments, it is pretty simple to roll your own function using the 
> >mail() function.
> 
> With a good class it's even simpler and much more reliable:
> 
> $mail = new Mail(…);
> $mail->addAddress(…);
> $mail->addAttachment(…);
> $mail->send();
> 
> Something like that.

Hmmm, I suppose this is true, but I've completed my mail client doing it 
all by hand (partly as an exercise, anyway). It appears to work so I'm 
not inclined to go back and re-engineer that part using a class. I did 
use a class for spam handling but that's largely because I found an 
example on the Internet to base it on.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689
0
Tim
11/21/2010 9:59:00 PM
On 21-11-10 21:38, The Magnet wrote:
> On Nov 21, 12:02 pm, Michael Fesser<neti...@gmx.de>  wrote:
>> .oO(Robert Hairgrove)
>>
>>> The Magnet wrote:
>>>> Hi,
>>
>>>> In this application the PHP scripts are running on one server, but the
>>>> postfix server is a different machine.  I tried this Pear mail and
>>>> although it does send using a report SMTP server there are a few
>>>> things that I cannot seem to do:
>>
>>>> - Cannot seem to alter headers to send HTML email
>>>> - Recipient always has email appear as "undisclosed-recipients"
>>
>>>> Can anyone help?  Is there a better / easier way to do this?  We need
>>>> to send HTML emails.  We tried PHPMailer and could not get it to work
>>>> at all, so, we are looking for another suggestion.
>>
>> It might help to say what "could not get it to work" means. Such a
>> simple "doesn't work" is no error description and hence pretty useless.
>>
>>> Most of these extra mail libraries are overkill.
>>
>> Not really.
>>
>>> Did you look at the PHP
>>> site documentation for the mail() function?
>>
>> If you have a reliable mailer class, you really don't want to use the
>> mail() function anymore. Especially creating MIME meassages by hand is
>> just nonsense, error-prone and too much work.
>>
>>> There are some examples
>>> (perhaps contributed by 3rd parties) which show you how to send HTML
>>> emails. If you always use the same format, i.e. maybe with no additional
>>> attachments, it is pretty simple to roll your own function using the
>>> mail() function.
>>
>> With a good class it's even simpler and much more reliable:
>>
>> $mail = new Mail(�);
>> $mail->addAddress(�);
>> $mail->addAttachment(�);
>> $mail->send();
>>
>> Something like that.
>>
>>> Also, it is a good idea to read the RFC docs referenced in the PHP site
>>> to understand what is going on WRT email headers.
>>
>> A good class takes care of all those things, including prevention of
>> header injection, which is often forgotten when using mail().
>>
>> Micha
>
>
> I'm sorry, I should have been more detailed.  I am running CentOS
> 5.x.  We were using mail(), but now since Postfix is on the other
> server, I need to find a way to have it use that server.
>
> With PHPMailer, there was some sort of class file which I could not
> find and could not get the procedure working.  I cannot explain it,
> just the call did not do anything.If you have an example of how
> PHPMailer is used or where I can go to see one, and get a complete
> copy of it, because the copies I downloaded were always missing some
> class.xxxxxxx.xxxxx  file.
>
> Thanks you a lot.
>
>

what is wrong with:
http://tinyurl.com/34y6r4g


-- 
Luuk
0
Luuk
11/22/2010 8:38:10 AM
Reply: