• Resolved beacondigital

    (@beacondigital)


    Hi All,

    As suggested in the subject, I would like to attach a PDF to the confirmation email sent out by ultimate member, is this possible? If so, how do I do this?

    Glen

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @beacondigital

    Unfortunately, there’s still no hooks for attaching a file in the Email. You will need to create a custom short tag or a link to the PDF file in the Email Body.

    Regards,

    Yes you are right it’s not possible from the UM level
    but you can attach files to emails by using a WP filter.

    add_filter( 'wp_mail', 'custom_add_email_attachment', 10, 1 );
    
    function custom_add_email_attachment( $args ) {
    
    	if( $args['subject'] == 'your subject for attachment' ) {
    		$args['attachments'] = array( WP_CONTENT_DIR . '/uploads/attachments/file-to-send.pdf' );
    	}
    	return $args;
    }

    Replace ‘your subject for attachment’ with the email subject from UM.

    Attachment to the email I use a new folder /uploads/attachments/
    for attachments and file name you change to your file by changing ‘file-to-send.pdf’

    • This reply was modified 3 years, 10 months ago by missveronica.
    • This reply was modified 3 years, 10 months ago by missveronica.
    Thread Starter beacondigital

    (@beacondigital)

    @beacondigital What about using a header attribute in the email template?

    @missveronicatv Thank you very much, I will give that a try!

    Thread Starter beacondigital

    (@beacondigital)

    @missveronica Worked like a charm,, thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Attach PDF to Confirmation Email’ is closed to new replies.