Hello I am trying to send mail with some attachment using with wordpress wp_mail
functionality but I am not getting attachment in my mailbox.
Can you please check my bellow code and guide me where I am wrong. You can see I am seeding image in attachment.
<?php
$to = 'my@email.com';
$subject="WordPress wp_mail";
$message="
<html>
<body>
<table rules="all" style="border-color: #666;" cellpadding="10">
<tr>Hello WordPress</tr>
</table>
</body>
</html>
";
$attachments = array( 'http://sitename/project/wp-content/plugins/my-plugin/uploads/sample_photo_01.jpg' );
//$attachments = array(WP_CONTENT_DIR . '/uploads/'.$_FILES["myfile"]["name"]);
$headers[] = 'MIME-Version: 1.0' . "\r\n";
$headers[] = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers[] = 'From: '.get_option( 'blogname' ).' <'.get_option( 'admin_email' ).'>';
wp_mail( $to, $subject, $message, $headers, $attachments );
?>
Thanks.