Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to send attachments in mail using PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 247
    Comment on it

    Hello Reader's! If your mail is contating some attachments then you can use the simplest way to sending the mail with attachments.

    Lets see the example below:-

    $email = new PHPMailer();
    $email->From      = '';
    $email->FromName  = 'Your Name';
    $email->Subject   = 'Message Subject';
    $email->Body      = $bodytext;
    $email->AddAddress( '' );
    $file_to&_attach = 'PATH_OF_YOUR_FILE_HERE';
    $email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );
    return $email->Send();

    This is the newPHPMail function that make you send the mail with the esieast way. To run this script you just have to follow some steps:- To use PHPMailer:

    Step 1:- Download the PHPMailer script from here Now Extract the archive and copy the script's folder to a convenient place in your project. Include the main script file -- require_once('path/to/file/class.phpmailer.php');

    And that's it will work when you call newPHPMailer()

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: