I’m trying to send html e-mail. When I’m sending e-mail without images or with images from another domains, it’s working fine. But when I’m putting image from my host, it doesn’t send e-mail at all.
I have tried send e-mail from another host using images from my domain, it seems like working.
Does anybody had similar issue and how can I tackle it?
EDIT: here is the function, wich I use.
function send_html_email($email = '', $template, $subject = '', $data = array()) {
/* email header */
ob_start();
require TEMPLATEPATH . '/email-templates/header.php';
$header = ob_get_contents();
ob_clean();
/* email content */
ob_start();
require TEMPLATEPATH . "/email-templates/{$template}.php";
$content = ob_get_contents();
ob_clean();
/* email footer */
ob_start();
require TEMPLATEPATH . '/email-templates/footer.php';
$footer = ob_get_contents();
ob_clean();
$message = $header . $content . $footer;
$headers[] = 'Content-type: text/html';
return wp_mail( $email, $subject, $message, $headers );
}
I have tried with wp_mail()
and mail()
functions, both are returning true
.
Don’t reinvent the wheel!
Sending advanced mail, hardcoding them into HTMLs mail() function is a tedious task.
Instead you should use something like phpMailer or use the PEAR package PEAR::Mail_Mime.
This since there is quite a few pitfalls to circumvent if you write your scripts yourself.