• Resolved yab1986

    (@yab1986)


    Hi guys

    Is there a way to send an attachment with the wp better mail.

    On a site I have following code:

    $mail = $mail[1];
    $attachments = array( WP_CONTENT_DIR . '/uploads/'.$object.'.pdf' );
    $content = 'Hello and welcome';
    wp_mail( $mail, 'Versand Verkaufsexposé', $content, $attachments );

    On the wp better mail I have following:
    %content%

    Everything works, but the attachment is not send. 🙁

    Any help?

    Greets, yab1986

    https://wordpress.org/plugins/wp-better-emails/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Nicolas Lemoine

    (@nlemoine)

    Hi yab1986,

    The plugin isn’t involved in your issue. Have a look at the wp_mail function: http://codex.wordpress.org/Function_Reference/wp_mail

    The attachments argument is the fifth one, not the fourth. You’re passing attachments as the “headers” argument.

    $mail = $mail[1];
    $attachments = array( WP_CONTENT_DIR . '/uploads/'.$object.'.pdf' );
    $content = 'Hello and welcome';
    wp_mail( $mail, 'Versand Verkaufsexposé', $content, '', $attachments );
    Thread Starter yab1986

    (@yab1986)

    Perfect. That works. 🙂 Thanks a lot!!!

    Hi, could someone explain to me what the problem with mine might be? I can send mail but with no attachments…I have two files, wp-mail.php and wp_mail_smtp.php (from the plugin) which is the one that is executed BUT I’ve been through numerous posts and each one talks about adding the $attachments parameter to the function in wp-mail…I don’t even have that function in wp-mail though, my wp-mail file doesn’t seem to relate to any of this! Could you help me on this?

    I’m on localhost.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘send attachment’ is closed to new replies.