Solved

Looking for simple mail class

Posted on 2008-10-08
2
151 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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
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 …

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now