Appnitro Software Forums » MachForm

sending email attachments

(9 posts)

  1. philm
    Member

    Hi,
    Is there a way I can attach a pdf to the email that is sent out to the person who completes my form?

    I have tried doing it as a simple <img src="domain.com/thefile.pdf"> but that doesn't seem to attach it in a way that is handled as an attachment by mail programs.

    Any help greatly appreciated.

    Posted 2 years ago #
  2. Are you asking about attaching the file the user submitted/uploaded or a completely unrelated file that you just want the Machform to send back to the user?

    The auto response email won't attach any files (not even the one submitted with the form)

    What you could do (which would be the nearest and easiest way) is to include a link in the body of the auto reply message to the file, the user would then just open the email, click the link and it would open the PDF in their Adobe reader, rather than opening the file attachment, it would simply be the file sitting on your web server.

    Not sure if I have addressed the question or whether it's more complex a task you want to complete.

    Posted 2 years ago #
  3. philm
    Member

    Thanks for your reply. Yes, you've got it spot on. I currently have a set up where people click a link in the confirmation email, but was hoping it my be possible to attach to the pdf to that email. Thanks anyway

    Posted 2 years ago #
  4. It is very bad to hear that.

    But I have one tip.

    If I use the Upload file field in the form and make hardcoded predefined file in there and also not able for submitter to change it - this will do the job.

    Can you please give a hint where to start it?

    p.s. I have some sort of knowledge of php...

    Posted 2 years ago #
  5. I had a support communication with the team and I want to give to all of you easy way how to do it.

    In the helper_functions.php just before this line

    $mail->Body = $email_content;

    add this line:

    $mail->AddAttachment('./data/form_'.$form_id.'/files/'.'filename.ext');

    where $form_id is the id of the form. You can use this parameter so all the forms can have some file to attach. If you want to separate the names of the files for each form you can use switch command.

    switch($form_id){
    case 1 ...
    ...
    }

    You can also avoid sending attachment to the emails to notification if it is on.

    if (!$target_is_admin) ...

    Posted 2 years ago #
  6. nunya
    Member

    I love what you have here...but can we take it a step further?

    We have a form with 4 check boxes on it where the visitor can select which PDF file(s) they want. I want to be able to attach the PDF files they chose to the email response automatically.

    Thank you!

    Posted 2 years ago #
  7. grandeland
    Member

    When I add this line:

    $mail->AddAttachment('./data/form_'.$form_id.'/files/'.'filename.ext');

    I don't visibaly notice anything changing in the form. Any Ideas?

    Posted 1 year ago #
  8. liz-ether
    Member

    How do I put the form ID in there? Mine is form id 11. And I don't understand how not to send the attachment to the admin.

    Thanks.

    Posted 6 months ago #
  9. You can add a condition into the code which attach the file.

    So, if your current code is something like this:

    $mail->AddAttachment('my_file.pdf');
    you can change it to become:

    if($target_is_admin == false){
    $mail->AddAttachment('my_file.pdf');
    }
    That should prevent the file being sent to admin.

    Posted 6 months ago #

RSS feed for this topic

Reply

You must log in to post.