Hello,
I am building a contactpage, page-contact.php.
I have something more complex in mind but as a test, I tried to add an attachment to wp_mail and it doesn't work. And that is my problem.
The mail itself works fine but there simply isn't an attachment. I use a simple text document, test.txt, that is located in the root of my there folder.
This is a simplified version of my code:
$headers = 'From: My Name <myname@mydomain.com>' . "\r\n";
$attachments = get_bloginfo('template_directory') . '/test.txt';
wp_mail( 'myname@mydomain.com', 'testmail', 'This is a testmail', $headers, $attachments);
Possible problems:
- path to attachment file is wrong
- $headers: content type is wrong
- attachment file is too small...?
- wrong setting in php.ini
None of these possibilities I have an answer to.
So here is my question: What am I doing wring or What could I be doing wrong?