I have created one contact form in html. In that once submit form email should sent with attachment whatever file they have selected in form.
Asked
Active
Viewed 554 times
-2
-
and what have you tried? – Agam Banga Jun 10 '17 at 17:56
-
Please read [What topics can I ask about](http://stackoverflow.com/help/on-topic) and [How to ask a good question](http://stackoverflow.com/help/how-to-ask) and [the perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and how to create a [Minimal, Complete and Verifiable Example](http://stackoverflow.com/help/mcve) **SO is not** a free Coding service ___We try to fix your code, we do not write your code___ – RiggsFolly Jun 10 '17 at 18:07
-
Look at the examples provided with PHPMailer. They include one that does exactly what you're asking for. – Synchro Jun 10 '17 at 21:10
-
I wonder how many people in the world are not familiar with the word 'google'! – MJ Khan Jul 08 '17 at 04:22
1 Answers
0
Look at this answer(answered by @sdc). Use PHPMailer script. Here is an example:
$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();
Saleh Mosleh
- 466
- 5
- 11
-
That doesn't answer the question as it does not cover how to upload a file to send. – Synchro Jun 10 '17 at 21:10
-
@Synchro here is an example of uploading a file using php :https://www.w3schools.com/php/php_file_upload.asp – Saleh Mosleh Jun 10 '17 at 23:56