Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.


Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Custom form upload file attach in email


3 Posts   2414 Views


19 August 2008 at 11:29pm (Last edited: 19 August 2008 11:31pm), Community Member, 12 Posts

Hi Guys

have a custom form related question as to attaching files and emailing them on.

In my fieldset I have:

new FileField ('CV','Upload your CV')

I am using php's mail function to send the email:

mail($email, $subject, $message, "From: ". $data['Email']);

and am unsure as to how I would include this attachment with the email. Does it have to go in as header information? Another solution if at all possible would be if the file could be uploaded so that it can appear in the Files and Images section in the CMS. Anyone know?



27 August 2008 at 4:16am Community Member, 12 Posts

Ah yup stupid me you have to put it in the header info of the mail function. You can modify this example:


30 August 2008 at 5:01am 4085 Posts

The PHP mail() function is extremely insecure. I'd recommend using Silverstripe's built in email classes.