Support » Plugin: Quick Contact Form » Adding Attachment to the Mail

  • Resolved Tanshaydar


    Thanks for the plugin. It works great; except two things.

    First, plugin was unable to send mails. I saw that my host has disabled PHP mail function. I have been forced to switch to using SMTP, with WP’s wp_mail function. For that part, it was easy.
    I just changed
    mail($qcf_email, $subject, $message, $headers);
    wp_mail( $qcf_email, $subject, $message, $headers);
    it works flawlessly.

    However, I need to send attachments to mail too. When I added $attach as a new variable to the function, it didn’t work.
    Is it possible to send the attachment with mail?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author aerin


    I’ve already been testing this solution to see if it solves the PHP mail problem. It seemed to work OK but you are giving me more confidence.

    If you want to send attachments don’t add $attach as a new variable to the function. It’s an array anyway and I can’t get the built in WP function to behave. The MIME boundaries are delicate creatures and when you send the attachment it doesn’t display properly in the email client.

    So just use:

    wp_mail( $qcf_email, $subject, $message, $headers);

    and let the plugin look after the attachments for you

    I see. I figured as much that $attach was an array and tried a few different array members to display but no dice.
    Well, at least it sends the mail just fine. However, where can I view the attachment if there is any? I can’t seem to find where it is uploaded or displayed for that matter.

    Plugin Author aerin


    The attachment is held to a temporary file, processed then forwarded to the recipient.

    It doesn’t get uploaded as such, it gets chopped into bits, sent as chunks and reassembled at the other end. If you want to view/save the attachment then you have to log into your email account.

    Plugin Author aerin


    A couple of links for you:

    Emails with attachments are sent as MIME objects:

    The script used to create the MIME object looks like this:
    Email attachment script

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding Attachment to the Mail’ is closed to new replies.