Skip to content

Commit c343ba5

Browse files
committed
Add attachment to test email
1 parent b94f0af commit c343ba5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

admin.widget.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ public function set_html_content_type()
5151
private function send_email($recipient)
5252
{
5353
add_filter('wp_mail_content_type', array($this, 'set_html_content_type'));
54+
$headers = array();
55+
$attachments= array(__DIR__ . '/sample.txt');
5456
$result = wp_mail($recipient,
5557
'SparkPost email test',
5658
'<h3>Hurray!!</h3><p>You\'ve got mail! <br/><br> Regards,<br/><a href="https://www.sparkpost.com">SparkPost</a> WordPress plugin</p>',
57-
''
59+
$headers,
60+
$attachments
5861
);
5962
remove_filter('wp_mail_content_type', array($this, 'set_html_content_type'));
6063
return $result;

sample.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a sample file to be sent as an attachment.

0 commit comments

Comments
 (0)