I tried to use wp_mail with attachments, but I cannot receive any attachments. Please help
$attachments = get_user_meta($userID, 'resume_pdf', true);
if ($attachments != '') {
wp_mail($to,$subject,$msg,$headers,$attachments);
$msg .= '<br><br>' . $attachments;
} else{
wp_mail($to,$subject,$msg,$headers);
}
what saved as resume_pdf is something like this: http://aiprojectlink.com/wp-content/uploads/userpro/1/560387d6eaa3b.pdf
I think it should be the full path, I can open the link directly by clicking it, but there is no attachment. Please help, thank you.
$attachments
should be path or array of paths. Not url.
Example from Codex:
$attachments = array( WP_CONTENT_DIR . '/uploads/file_to_attach.zip' );
$headers = 'From: My Name <myname@example.com>' . "
";
wp_mail( 'test@example.org', 'subject', 'message', $headers, $attachments );