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
    • 276
    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      = 'you@example.com';
    $email->FromName  = 'Your Name';
    $email->Subject   = 'Message Subject';
    $email->Body      = $bodytext;
    $email->AddAddress( 'destinationaddress@example.com' );
    
    $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
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: