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

    $attachments = array( WP_CONTENT_DIR . '/uploads/' );
    $headers = 'From: My Name <>' . "rn";
    wp_mail( '', 'subject', 'message', $headers, $attachments );

    Best regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.