-
HTML Email Problem
I recently started working on a page that will allow users to send emails inviting their friends to the website. I was bored of the plain text emails, so I decided to go with HTML emails. I managed to get the emails to send to my own email address, but no other addresses could receive the email.
I am using: mail(to, subject, body, header)
My header consists of:
$header = "From: <-Email Goes Here->
MIME-Version: 1.0
Content-type: text/html; charset=ISO-8859-1";
I was wondering if anyone might know what the problem is.
The email DOES send to any email address hosted on my website, but does not work for any other email address, nor does it work when forwarding through my website.
My website is hosted by Siteground, so I'm wondering if there is any possible mail configuration that might be blocking the emails.
If you know what may be going on, all help is greatly appreciated.
Thanks
- Austin
-
After a few minutes of thinking, I think I figured out how to fix this (sort of). I haven't looked at PEAR mail much, but I'm guessing that that may be the answer to solving this problem. I'll try it out and see if I still have any problems.
-
Fixed
To answer my own question, yes, PEAR mail fixed the problem.
If anyone is experiencing something similar, or simply wants to do the same, here the code I used.
__________ Code __________
<?php
$to = "_____________"; // Address to send to
$subject = "_______________"; // Subject of email
$from = "______________"; // Sender name/address
$body = "______________"; // HTML version of body
$textbody = "____________"; // Text version of body
$host = "________________"; // Email Host
$username = "___________"; // Email Username
$password = "___________"; // Email Password
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mime = new Mail_mime(array('eol' => $crlf));
$mime->setTXTBody($text);
$mime->setHTMLBody($body);
$body = $mime->get();
$headers = $mime->headers($headers);
$mail = $smtp->send($to, $headers, $body);
?>
__________ Code END __________
Hopefully this will end up helping someone.
- Austin
-
do like this
<p><font... face="Arial"><........strong>Contact by E-mail</..........strong></......font></p>
<p><a href="mailto:xxxxxxxxx@gmail.com"><font face="Arial"
color=#003366>xxxxxxxxx@gmail.com</font></a></p>
Similar Threads
-
By imdavidlee in forum Hosting Related Questions
Replies: 4
Last Post: 05-31-2011, 12:43 AM
-
By nwwds in forum Hosting Related Questions
Replies: 1
Last Post: 02-28-2010, 05:54 AM
-
By timshel in forum Hosting Related Questions
Replies: 1
Last Post: 05-14-2008, 11:40 AM
-
By mcdowalr in forum General Joomla Discussions
Replies: 2
Last Post: 12-11-2007, 02:10 AM
-
By phoenix5 in forum Other Software and Applications
Replies: 2
Last Post: 02-12-2007, 02:57 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Copyright © 2012 SiteGround.com Inc