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.

Archive /

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

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

Custom form upload file attach in email

Go to End

3 Posts   3088 Views


Community Member, 12 Posts

19 August 2008 at 11:29pm

Edited: 19/08/2008 11:31pm

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?



Community Member, 12 Posts

27 August 2008 at 4:16am

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


Forum Moderator, 4102 Posts

30 August 2008 at 5:01am

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