473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MIME type in Mail.php

190 100+
Hi ,

Am new in PEAR. I have using PEAR/Mail.php for sending mails using smtp authentication. Here that my mailto form.
[php]<?php
session_start();
ini_set("smtp_port",25);
include("Mail.php");
$name=$_POST["name"];
$email=$_POST["email"];
$phone=$_POST["phone"];
$company=$_POST["company"];
$message=$_POST["message"];
if( isset($_POST['security_code'])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
//echo 'Thank you. Your message said "'.$_POST['message'].'"';
//Generate Mail
//================
// To send HTML mail, you can set the Content-type header.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: xxxxxx";
$recipient="xxxxxxxx";
//subject
//========
$subject="Send Mail.";
//message
//=======
$message="
<table width=60% border=0 cellpadding=4 cellspacing=1 bgcolor=#cccccc>
<TR>
<TD colspan=2><font face=Arial size=2><b>Send Mail </b></font></td>
</tr>
<TR>
<TD bgcolor='#EFEFEF'><font face='Arial' size='2'>Name</font></td>
<TD bgcolor='#FFFFFF'><font face=Arial size=2>$name</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Email ID</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$email</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Telephone</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$phone</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Company</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$company</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Comments / Messages</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$message</font></td>
</tr>
</table>";
//SMTP process start=====================
$body=$message;
$smtp_obj=new Mail;
$from="xxxx@xx.x";
$host = "xxxx";
$username = "xxxx@xx.xx";
$password = "xxxx";
$to="xxx@xx.xx";
// $subject= mb_encode_mimeheader($subject,"UTF-8", "B", "\n");
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp_obj->send($to, $headers, $body);
if (!PEAR::isError($mail))
//echo("<p> Sorry, you have provided an invalid security code</p>");
$content= 'Our Representative will contact you soon. Thank you for contacting us.';
unset($_SESSION['security_code']);
} else {
//echo("<p>Message successfully sent!</p>");
$content= 'Sorry, you have provided an invalid security code<br><br>';
$content.= '<input type="button" value="Go back" onClick="history.back();">';
}
}
?>[/php]And am inlcude pear/mail.php

Using this i got mail...But html tags printed with our parsing..i think it print text mime type... How can i change into html
May 26 '08 #1
3 2463
ronverdonk
4,258 Expert 4TB
LAST WARNING:
As a member you (should) know by now, and you have been warned before, that you have to include any code within the appropriate code tags! Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Use [code] tags in future.

MODERATOR
May 26 '08 #2
maheswaran
190 100+
I got the answer for above one


Just modify the below code

<php code>
$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
<php code>
into


$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject,'Headers'=>$headers);
May 28 '08 #3
hsriat
1,654 Expert 1GB
I'm glad you got the answer, otherwise I was too lazy to read the whole bunch of code.
May 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: johnny | last post by:
hi all, I have a script to send newsletters both in html and text version, all works fine in email clients but unfortunately not in yahoo mail: it shows nothing in the body of the message,...
4
by: Alberto | last post by:
I am struggling with the php mail function so to allow a multipart mime settings where both the message and any set of attachments can be allowed. Teorically, I'd know how to do. I build up my...
0
by: bobkaku | last post by:
I added "MIME-Version: 1.0\r\nContent-Type:text/html; charset=iso-8859-1\r\n" as one of the parameters in the mail( ) function to replace the "Nobody" with a real From: email. That worked. ...
2
by: bobkaku | last post by:
I added "MIME-Version: 1.0\r\nContent-Type:text/html; charset=iso-8859-1\r\n" as one of the parameters in the mail( ) function to replace the "Nobody" with a real From: email. That worked. ...
13
by: stam | last post by:
hello guys, i have met a problem that i can send the html e-mail by using MIME via php to yahoo mail and hotmail, but when i was try to send to gmail, it show all the html coding. can someone help...
2
by: Der tolle Emil | last post by:
Hi! I wrote a little function to send emails which works quite well. I already managed to send attachments correctly (also more than 1 per email) but I am not able to send a HTML mail containing...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
4
by: ceh | last post by:
Hi, on windows xp I'm using xampp v 1.6.4 I'm trying to send mail. The mail always sends, but the multipart sections are broken. Essentially, I want to send an html email that has a link...
3
by: Steven Allport | last post by:
I am working on processing eml email message using the email module (python 2.5), on files exported from an Outlook PST file, to extract the composite parts of the email. In most instances this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.