Solved

Looking for simple mail class

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

790 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