Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2009, 05:25 AM
Registered User
 
Join Date: Dec 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default how do I send html mail with image link???

hi,

nice to meet you,
actually I am suffering with HTML. I am making a application for newsletter all the codes are works but images cannot display and its comes like link break, even I use ur coding as it is, but still same here below I say some dtails.
PHP Code:
 $subject 'testing';
        
$message '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="500px"b border="1">
<tr bgcolor="#0099FF">
    <td width="50%"> Name </td><td width="25%"> Age </td>    <td width="25%"> Rank </td>
</tr>
<tr bgcolor="#FFFF99">
    <td>&nbsp;</td>    
    <td>&nbsp;</td>    <td>&nbsp;</td>
</tr>
<tr>
    <td></td><td width="100%"><img src="http://alnjoum.net/img/newsletter/images/gdr.jpg" width="500px" height="350px"/></td><td></td>
</tr>
</table>    

</body>
</html>
'
;
    
$to 'someone <someone @somehwhere.co.uk>';

    
$headers "From: you <[email protected]>\r\n";

    
$headers .= "MIME-Version: 1.0\r\n";

    
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    
$headers .= "Reply-to: you <[email protected]>\r\n";

    
$headers .= 'X-Mailer: PHP/' phpversion()."\n";



    if(
mail($to$subject$message$headers)){
              
//success
        
}else{
              
//error
        

this all above works and image with links (maps also) are working.
but when I use variable for take the html stuff from the Form so it cant, here below my code with Form.

PHP Code:

<?php
$headers 
"[email protected]";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-to: Me <[email protected]>\r\n";
$headers .= 'X-Mailer: PHP/' phpversion()."\n";

$subject $_POST['subj'];
$message $_POST['msg'];
    
$to '[email protected]';

    if(
mail($to$subject$message$headers)){
            echo 
'sent successfully';  //success
        
}else{
             echo 
'some error.';//error
        
}
        
?>
<form action="try.php" method="post">
subject : <input type="text" name="subj"><br />
Message : <textarea name="msg" cols="60" rows="5"></textarea> <br />
<input type="submit" name="submit" value="submit">
</form>
 
Old December 17th, 2009, 04:32 AM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello friend u should pass image complete path separately and get that value at server side and concatenate with message then send it
follow link
http://opensourceprogrammer.blogspot...end-using.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent - Send mail with plain view and html view ashish.dadhwal ASP.NET 2.0 Professional 0 November 27th, 2008 01:49 AM
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Send mail with image. dpkbahuguna Beginning VB 6 0 June 19th, 2007 06:47 AM
how to send activation link with e mail spbharti PHP How-To 2 December 28th, 2005 09:17 AM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.