Wrox Programmer Forums
|
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 May 15th, 2007, 08:34 AM
Authorized User
 
Join Date: Sep 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to aneesh_sunu@yahoo.co.in Send a message via Yahoo to aneesh_sunu@yahoo.co.in
Default Mail issue

hi
            I wrote a mail function for send mail, but when it get it contain html tags, How it can solve
__________________
Regards
Aneesh
 
Old May 16th, 2007, 08:05 AM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try following code
        $subject = 'testing';
        $message = 'testing';
    $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
        }
you the above code replace the emails with your ones. the headers tells that it is html or text
hope it will help

Zerone
Moderator At
www.chatbazaar.com
http://directory.chatbazaar.com
 
Old December 10th, 2009, 04:55 AM
Registered User
 
Join Date: Dec 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default some problem with variable

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>
why ????
plz solve the problem





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send Mail Task Issue ninel SQL Server DTS 1 April 10th, 2006 03:41 PM
Send Mail issue Calverstine Dreamweaver (all versions) 1 August 9th, 2005 04:31 PM
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.