I researched over the internet, but could not find what i need :/
I have a contact form, (php). I dont have any database. it is a simple php email form, but now I need to make it with file attachment :/ how can I email file via contact form? visitor will browse any file from his computer and send email via form.
appreciate!!
I've taken a look at the link in the comments and cleaned up a few things into a function. For one thing I've used an associative array of arguments and heredocs, since the use of php tags and output buffering in the example weren't exactly clean (or as clean as PHP will get).
http://aramk.com/php/php-sending-an-email-attachment/
emailFile(array(
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Some Subject',
'message' => '<b>Hello!</b>',
'plain ' => 'Get a new email client!',
'file' => '/path/to/file'
));
You can pass along the file path from $_FILES into the "file" argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With