ohdang888 Posted October 30, 2008 Share Posted October 30, 2008 i put "<a href='http://www.google.com/'>Link</a>" in my email sending function, in the body.... and i get the email, but then it shows the html.... and my html on my email is turned on... any idea>? Link to comment https://forums.phpfreaks.com/topic/130713-solved-html-mail/ Share on other sites More sharing options...
feidakila Posted October 30, 2008 Share Posted October 30, 2008 maybe you need to set properly the headers of the mail function. Check the php manual, I copied this from there // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; then pass $headers to the mail function call Link to comment https://forums.phpfreaks.com/topic/130713-solved-html-mail/#findComment-678330 Share on other sites More sharing options...
Mchl Posted October 30, 2008 Share Posted October 30, 2008 I'm not sure, but maybe you should start your message's body with <html> ? Or maybe there are some headers to be set? --- Edit: Well.. feidakila says there are Link to comment https://forums.phpfreaks.com/topic/130713-solved-html-mail/#findComment-678331 Share on other sites More sharing options...
ohdang888 Posted October 30, 2008 Author Share Posted October 30, 2008 o'm using the mail tutorial on this site... now i'm getting an error: Warning: Invalid argument supplied for foreach() in /home/ky4obama/public_html/mail/Mail.php on line 123 Warning: Invalid argument supplied for foreach() in /home/ky4obama/public_html/mail/Mail.php on line 151 Failed to set sender: M [sMTP: Invalid response code received from server (code: 501, response: : sender address must contain a domain)] It sent mail before, with just that headers as an array, so i guess the new headers is messing it up.... any ideas? Thanks! <?php require_once "mail/Mail.php"; $host = "server1.freesitespace.net"; $username = " "; $password = " "; $from = " my newsletter email address "; $to = "[email protected] "; $subject = "subject"; $body = "<a href='http://www.google.com/'>Google</a><br><img href='http://www.google.com/intl/en_ALL/images/logo.gif'>"; $reply = " [email protected]"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= array("From" => $from, "To" => $to, "Subject" => $subject, "Reply-to" => $reply); $smtp = Mail::factory("smtp", array ("host" => $host, "auth" => true, "username" => $username, "password" => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo "<p>" . $mail->getMessage() . "</p>"; } else { echo "<p>Message successfully sent!</p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/130713-solved-html-mail/#findComment-678451 Share on other sites More sharing options...
ohdang888 Posted October 31, 2008 Author Share Posted October 31, 2008 rump de bump Link to comment https://forums.phpfreaks.com/topic/130713-solved-html-mail/#findComment-678935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.