Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another mail problem..

Status
Not open for further replies.

harrism

Technical User
Mar 18, 2005
4
GB
I can send mail from my linux box using 'Linux mail()' OK.

If I use PHP mail a header is added.

Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64

--
The format I'm using to send is;

<?php
mail($to, $subject, $message)
?>

This used to work, so something must have changed..
Any advice as to why this is happening appreciated.

Thanks
 
What is the error you're getting? Where do variables come from? It is hard to answer without basic knowledge of what is failing.
 
The error is that this header is being added..

Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64

Using php mail(), as I understand it, there should not be a header unless I explicitly put it there.

If I do add a header I end up with something like this;

Mime-Version: 1.0
Content-Type: multipart/mixed;
Content-Disposition: inline
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64

Again this additional header has been added which breaks everything.
.
 
Whenever it comes to sending mail with PHP I recommend the PHPMailer class, available at phpmailer.sourceforge.net
It is excellent and solves all problems people usually run into trying to write their own mailer code.
 
<?php
mail(me@myisp.com, Test Message, This is just a test)
?>

The PHP mail() function should be pretty straight forward.
The above code should not add a header but something is..
 
Those strings should be quoted:
Code:
<?php
mail('me@myisp.com', 'Test Message', 'This is just a test');
?>

Ken
 
Yes, sorry you are correct - it was a quick reply.

something still adds the header though..

Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64
 
On what OS through which mail server are you sending these messages?

On my LAMP (FC3/2.0.53/4.1.10/5.0.3) box, sending email through postfix 2.1.5, those headers are not added.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top