Solved

Looking for simple mail class

Posted on 2008-10-08
2
158 Views
Last Modified: 2012-05-05
I am aware of many email classes like phpmailer and swiftmailer but these are all complex with many files.

I am looking for a simple PHP mail class that only uses sendmail (NOT SMTP) and fits in just ONE php file.

It should send proper headers and should guard against common attacks.

Any ideas?
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Assisted Solution

by:Lordgobbledegook
Lordgobbledegook earned 200 total points
ID: 22669678
I use phpmailer but my understanding is that you do not need the entire distribution.  I currently have 3 files and it works fine.  If you are just using sendmail then you can probably just use class.phpmailer.php and no other files.
0
 
LVL 3

Accepted Solution

by:
DerkArts earned 300 total points
ID: 22673833
Agreed, phpmailer is excellent, see this:

You can find full documentation anywhere. This is all i use to send emails.

(You do need a second file, class.smtp.php, that makes 2 file total)
require("class.phpmailer.php");
 
$mail = new phpmailer();
 
$mail->From     = "list@example.com";
$mail->FromName = "List manager";
$mail->Host     = "smtp1.example.com";
$mail->Mailer   = "smtp";
$body  = "Test EMail body <b>can be HTML</b>";
$mail->Body    = $body;
$mail->AddAddress("test@test.com");
$mail->AddCC("testcc@test.com");
 
if(!$mail->Send())
        echo "There has been a mail error";

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question