This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

sending email attachments


  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 15 years ago #
  2. AMurray
    Pro Member

    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 15 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 15 years ago #
  4. elvar
    Member

    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 15 years ago #
  5. elvar
    Member

    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 15 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 15 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 14 years 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 13 years ago #
  9. yuniar

    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.


    MachForm Founder

    Posted 13 years ago #
  10. chickc
    Member

    Hi yuniar, long time no talk to.

    Just like nunya above I have a client that would like to create a form with 4 check boxes on it where the visitor can select which product infoPDF file(s) they want sent to them (as an attachment to the confirmation email sent to them).

    Is there a way to do that?

    Posted 8 years ago #
  11. williamansley
    Member

    Why not just have links to all of the PDFs on a web page, from which the user can download the ones that are wanted? I am asking because there may be alternative ways of doing something similar to what your client wants, but I don't think I really understand the requirements, since they don't make much sense to me, as you describe them.

    Posted 8 years ago #
  12. chickc
    Member

    Well, if the client doesn't want his visitor to download all of his product pdf's (could be confusing) and wants to know which product the client is most interested in, it would be best for the visitor to select the product information from the form and then deliver that specific pdf in an email back to the visitor.

    This gives my client a lead that shows the person's name, email address, phone and which specific product they are interested in. But if we just send them to a product download page from a link, we are exposing where others can find it without bothering to fill out a lead generating form.

    Does that make better sense?

    Posted 8 years ago #
  13. williamansley
    Member

    @chickc: OK, that makes sense. Currently, Machform doesn't create email attachments for notification emails. You can't make it do that without modifying the base code, and I can't help you with that. It seems like a useful feature; I hope Appnitro is listening.

    But you can get a similar effect by using email logic, if your client is willing to have a slight modification made made to the specifications, and if you are using version 3.5 or newer of Machform, so that it supports email logic. The specification modification I mentioned is that the email will contain a link to the appropriate file on a web server (or other server). The file will be downloaded by clicking on the link in the email. Upload the PDF files to an acceptable location. Create a separate email template for each file, with a link to the appropriate PDF file. Then use email logic to chose the proper email template based on which checkbox is chosen.

    http://www.appnitro.com/blog-conditional-logic-for-notification-emails

    One downside is that, since your client wants to allow the user to chose any combination of the four forms with checkboxes, the user could receive as many as four separate emails for one form submission, which may be perceived as inconvenient. However, on the plus side, you can add a meaningful subject line for each email, potentially making it easier for the user to find the appropriate email later on, if they want another copy of the PDF.

    Posted 8 years ago #

RSS feed for this topic

Reply