Skip to content


SimpleMail - Easily send email’s with attachments from php.

Here is a pretty simple class that uses the default mail function so no sockets or direct connections to server’s
have to be used. But this script will allow you to add multiple contacts, as well as multiple attachments, easily.

It is as simple as this.

  1. <?php
  2.     include "SimpleMail.php";
  3.     $mail = new SimpleMail("test@domain.com", "test@test.com", "This is a test message");
  4.    
  5.     $msg = "This is a quick test message, just sending some attachments\n";
  6.     $msg.= "with this test email, yeah";
  7.    
  8.     $mail->AddMessage($msg);
  9.     $mail->AddAttachment("test.txt");
  10.     $mail->AddAttachment("test.png");
  11.     $mail->AddAttachment("test.jpg");
  12.    
  13.     if($mail->SendMessage()) {
  14.         echo "Your message was sussecfully sent";
  15.     }
  16.     else {
  17.         echo "Your message failed to send, please try again later";
  18.     }
  19. ?>

Hope someone finds it useful, enjoy.
SimpleMail (119)

Posted in PHP, Software, code..

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.