Solved

Looking for simple mail class

Posted on 2008-10-08
2
157 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How would I construct this INSERT statement in PDO? 6 33
JQuery Search Filter 2 71
deprecated mysql extensions 1 30
Group By Function Required in PDF Output 21 38
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

730 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