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 ?
Asked
Active
Viewed 441 times
0
-
1Question not very clear – haakym Apr 24 '16 at 12:48
-
You want to add a mail-to button which attaches a file? – Ani Menon Apr 24 '16 at 12:56
-
@AniMenon yes, the button is on every list files. For example there is a file with the name 'office.pdf' and the mail-to button on it, if I click it the file will be attached as attachement. Is it possible ? – Hendrik Eka Apr 24 '16 at 14:36
1 Answers
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