24
Jul
08

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.

<?php
    include "SimpleMail.php";
    $mail = new SimpleMail("test@domain.com", "test@test.com", "This is a test message");

    $msg = "This is a quick test message, just sending some attachments\n";
    $msg.= "with this test email, yeah";

    $mail->AddMessage($msg);
    $mail->AddAttachment("test.txt");
    $mail->AddAttachment("test.png");
    $mail->AddAttachment("test.jpg");

    if($mail->SendMessage()) {
        echo "Your message was sussecfully sent";
    }
    else {
        echo "Your message failed to send, please try again later";
    }
?>

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


0 Responses to “SimpleMail - Easily send email’s with attachments from php.”


  1. No Comments

Leave a Reply