I am trying to attach external file link (doc file) as attachment but not able to so .. no attachment is being attached..
$email_attachment = array('/');
wp_mail($admin_email,$email_subject,$email_message,$headers,$email_attachment);
Please help I am stuck
I am trying to attach external file link (doc file) as attachment but not able to so .. no attachment is being attached..
$email_attachment = array('https://ucarecdn/8aa17c61-bd55-4311-8b45-7d9a2efde6c5/');
wp_mail($admin_email,$email_subject,$email_message,$headers,$email_attachment);
Please help I am stuck
You can't attach from a URL. So https://ucarecdn/8aa17c61-bd55-4311-8b45-7d9a2efde6c5/
won't work.
You need an absolute path to the file, such as /path/to/my/file.ext
.
But there are some other problems with your code snippet as well. You use $email_attachement
(with a ..chement...) in one place, but then $email_attachment
in your wp_mail()
call. Also, your "attachment" isn't a file. While that may resolve as a URL, that would involve a URL rewrite which isn't going to work for accessing a file to attach.