Sending mails with attach? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Sending mails with attach?

ljubaljuba Posts: 106Member
Is here somebody who has some example for this?

PS: Is there any quota for size of attached files?

Thanks a lot

LJUBA

Comments

  • ljubaljuba Posts: 106Member
    require("class.phpmailer.php");

    $mail = new phpmailer();
    $mail->IsSMTP(); // send via SMTP
    $mail->Host = "smtp1.site.com;smtp2.site.com"; // SMTP servers
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "jswan"; // SMTP username
    $mail->Password = "secret"; // SMTP password
    $mail->From = "[email protected]";
    $mail->FromName = "Mailer";
    $mail->AddAddress("[email protected]","Josh Adams");
    $mail->AddAddress("[email protected]"); // optional name
    $mail->AddReplyTo("[email protected]","Information");
    $mail->WordWrap = 50; // set word wrap
    $mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
    $mail->AddAttachment("/tmp/image.jpg", "new.jpg");
    $mail->IsHTML(true); // send as HTML
    $mail->Subject = "Here is the subject";
    $mail->Body = "This is the HTML body";
    $mail->AltBody = "This is the text-only body";
    if(!$mail->Send())
    {
    echo "Message was not sent

    ";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
    }
    echo "Message has been sent";
    ************************************************************
    class:
    Win : http://prdownloads.sourceforge.net/phpmailer/phpmailer-1.50.zip
    Unix : http://prdownloads.sourceforge.net/phpmailer/phpmailer-1.50.tar.gz
    ************************************************************
    http://www.phpwizard.net/resources/phpMisc/scripts/pretty/mail.php3
    ************************************************************
    http://www.hotscripts.com/PHP/Scripts_and_Programs/Email_Systems/Email_Utilities/
    ************************************************************

Sign In or Register to comment.