Monday 15 February 2010

php - Hyperlinks in gmail message -



php - Hyperlinks in gmail message -

i trying send email php smtp. part of message <a href='http://www.yahoo.com'> , href='http://www.google.com'> b </a>

but not see hyperlinks in received gmail message. email looks above string. how hyperlinks?

the php code looks like:

$body = "something including above code"; $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = array( 'from' => $from, 'to' => $email, 'subject' => $subject ); $smtp = mail::factory('smtp', array(... host port uth username password ... )); $mail = $smtp->send($email, $headers, $body)

you should add together headers email message illustration :

$headers = 'content-type: text/html;'; $message = <<<eod <h1> hello world <h1> <a href="https://search.yahoo.com/">goto yahoo</a> <a href="https://www.google.com/">goto google</a> eod; $result = mail('your-email@gmail.com', 'hello world', $message,$headers); if($result){ echo 'message sent'; }else{ echo 'failure'; }

you can read more sending html mail service function @ php.net

php email smtp gmail

No comments:

Post a Comment