0

in my case, I have to add the email button on the file list but before it I must be signed first so that the file can be viewed, this email button when clicked the file will automatically be in the form of attachment when sending mail. In that cases is it possible without having to download the file first and then browse the file as attachment ?

Ani Menon
  • 27,209
  • 16
  • 105
  • 126
Hendrik Eka
  • 145
  • 3
  • 14

1 Answers1

0

Basic version (using php):

$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();

Reference : Send attachments with PHP Mail()?

Using laravel 5.0:

Mail::send('emails.welcome', $data, function($message)
{
    $message->from('us@example.com', 'Laravel');

    $message->to('foo@example.com')->cc('bar@example.com');

    $message->attach($pathToFile);
});

Refer : Laravel mail

Community
  • 1
  • 1
Ani Menon
  • 27,209
  • 16
  • 105
  • 126