Mail system – WordPress

Hi, I wish to send an email with an attachment from WP. I wish to code a page which sends an email by the data given by the user, and ads attached the file to it. I know it out of the scope of your support but if I can get good advice, direction, or example that would be great.

  • Ivan
    • Developer

    Hi @Bela !

    You can use wp_mail() function for that. More info here.

    One of the examples from this manual for sending attachment

    <?php
    $attachments = array( WP_CONTENT_DIR . '/uploads/file_to_attach.zip' );
    $headers = 'From: My Name <myname@example.com>' . "rn";
    wp_mail( 'test@example.org', 'subject', 'message', $headers, $attachments );

    Best regards,

    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.