Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Custom form upload file attach in email

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

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

Page: 1
Go to End
Author Topic: 2298 Views
  • Arm
    Avatar
    Community Member
    12 Posts

    Custom form upload file attach in email Link to this post

    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?

    thanks!

  • Arm
    Avatar
    Community Member
    12 Posts

    Re: Custom form upload file attach in email Link to this post

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

    http://icrontic.com/forum/showthread.php?t=7019

  • UncleCheese
    Avatar
    4085 Posts

    Re: Custom form upload file attach in email Link to this post

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

    2298 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.