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_p ort",25);
include("Mail.p hp");
$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($_SESSIO N['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="xxx xxxxx";
//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='#EFEFE F'><font face='Arial' size='2'>Name</font></td>
<TD bgcolor='#FFFFF F'><font face=Arial size=2>$name</font></td>
</tr>
<tr>
<td bgcolor='#EFEFE F'><font face='Arial' size='2'>Email ID</font></td>
<td bgcolor='#FFFFF F'><font face=Arial size=2>$email</font></td>
</tr>
<tr>
<td bgcolor='#EFEFE F'><font face='Arial' size='2'>Teleph one</font></td>
<td bgcolor='#FFFFF F'><font face=Arial size=2>$phone</font></td>
</tr>
<tr>
<td bgcolor='#EFEFE F'><font face='Arial' size='2'>Compan y</font></td>
<td bgcolor='#FFFFF F'><font face=Arial size=2>$company </font></td>
</tr>
<tr>
<td bgcolor='#EFEFE F'><font face='Arial' size='2'>Commen ts / Messages</font></td>
<td bgcolor='#FFFFF F'><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_mimeh eader($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>Messag e successfully sent!</p>");
$content= 'Sorry, you have provided an invalid security code<br><br>';
$content.= '<input type="button" value="Go back" onClick="histor y.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
3 2494 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
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,'Heade rs'=>$headers);
hsriat 1,654
Recognized Expert Top Contributor
I'm glad you got the answer, otherwise I was too lazy to read the whole bunch of code.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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, however if I forward that
mail from yahoo I can see it perfectly again in outlook/eudora.
By some trial and errors I found that without the first 2 headers, it
works fine in yahoo mail too, so what's wrong with my headers ?
Thanks in advance to who...
|
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 headers and pass them as
the fourth argument of the function mail().
Practically, what happens is that whenever I try to test my script
emailing myself, what appears in the email body are the __cleartext__
headers.
|
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.
But if I attempt to add any other terms, such as the sender's name and
location, the MIME parameter above seems to ignore the "\n" line feeds
and put the these other terms ahead of the mail message.
Here's my code:
|
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.
But if I attempt to add any other terms, such as the sender's name and
location, the MIME parameter above seems to ignore the "\n" line feeds
and put the these other terms ahead of the mail message.
Here's my code:
|
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 me to solve this kind of problem? thank you
the coding i made----->:
<?php
$a=<<<A
| |
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 a text only block for non-HTML
clients. I will not post the PHP code as I think it is irrelevant, the error
lies within the mail header and/or body, so here is the mail I do want to
send:
FROM: me <foo@bar.com>
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I prompt a "Save As" dialog for an
accepted mime type?
-----------------------------------------------------------------------
It is not possible with client-side JavaScript.
Some browsers accept the Content-Disposition header, but this
must be added by the server. Taking the form:-
` Content-Disposition: attachment; filename=filename.ext `
|
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 it, like http://www.google.com so the reader can click on
the link.
When I get the email, the body is empty.
|
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 works fine, the message is read
in using message_from_file, is_multipart returns True and I can process each
component and extract message attachments.
I am however running into problem with email messages that contain emails
forwarded as...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |