Hey everyone,
I am stumped once more and you guys have always helped in one way or the other.
I am just now starting to fool around with using PEAR to send html emails. Following the sample scripts -- http://www.phpmaniac.net/wiki/index....ple_recipients -- I was able to send html emails with no problem.
However, when I applied these concepts to a dynamically generated email, the recipients would receive an email with random equal signs appearing in the email.
Here's the code: -
$message = '<table>';
-
// used for displaying thank you page after the form is submitted
-
$email_message = $new_html_var2;
-
-
if(!empty($_POST['typeSub']))
-
{
-
$message =$message. '<tr><td>Thank you for ordering '.$_POST['typeSub'].' subscription of Script Magazine</td></tr>';
-
}
-
if(!empty($_POST['bfname']))
-
{
-
$message=$message. '<tr><td>Billing Info'.'</td></tr><tr><td>'.'First Name: '.$_POST['bfname'].'</td></tr>';
-
}
-
if(!empty($_POST['blname']))
-
{
-
$message=$message. '<tr><td>Last Name: '.$_POST['blname'].'</td></tr>';
-
}
-
if(!empty($_POST['bcompany']))
-
{
-
$message=$message. '<tr><td>Company: '.$_POST['bcompany'].'</td></tr>';
-
}
-
if(!empty($_POST['baddress1']))
-
{
-
$message=$message. '<tr><td>Address 1: '.$_POST['baddress1'].'</td></tr>';
-
}
-
if(!empty($_POST['baddress2']))
-
{
-
$message=$message. '<tr><td>Address 2: '.$_POST['baddress2'].'</td></tr>';
-
}
-
if(!empty($_POST['bcity']))
-
{
-
$message=$message. '<tr><td>City: '.$_POST['bcity'].'</td></tr>';
-
}
-
if(!empty($_POST['bstate']))
-
{
-
$message=$message. '<tr><td>State: '.$_POST['bstate'].'</td></tr>';
-
}
-
if(!empty($_POST['bzip']))
-
{
-
$message=$message. '<tr><td>Zip/Postal Code: '.$_POST['bzip'].'</td></tr>';
-
}
-
if(!empty($_POST['bcountry']))
-
{
-
$message=$message. '<tr><td>Country: '.$_POST['bcountry'].'</td></tr>';
-
}
-
if(!empty($_POST['bemail']))
-
{
-
$message=$message. '<tr><td>Email: '.$_POST['bemail'].'</td></tr>';
-
}
-
if(!empty($_POST['bphone']))
-
{
-
$message=$message. '<tr><td>Phone: '.$_POST['bphone'].'</td></tr>';
-
}
-
if(!empty($_POST['ACCT']))
-
{
-
$message=$message. '<tr><td>Card number ending in: '.substr($_POST['ACCT'], -4).'</td></tr>';
-
}
-
-
if(!empty($_POST['sfname']))
-
{
-
$message=$message. '<tr><td>Shipping Info'.'</td></tr><tr><td>'.'First Name: '.$_POST['scompany'].'</td></tr>';
-
}
-
if(!empty($_POST['slname']))
-
{
-
$message=$message. '<tr><td>Last Name: '.$_POST['slname'].'</td></tr>';
-
}
-
if(!empty($_POST['scompany']))
-
{
-
$message=$message. '<tr><td>Company: '.$_POST['scompany'].'</td></tr>';
-
}
-
if(!empty($_POST['saddress1']))
-
{
-
$message=$message. '<tr><td>Address 1: '.$_POST['saddress1'].'</td></tr>';
-
}
-
if(!empty($_POST['saddress2']))
-
{
-
$message=$message. '<tr><td>Address 2: '.$_POST['saddress2'].'</td></tr>';
-
}
-
if(!empty($_POST['scity']))
-
{
-
$message=$message. '<tr><td>City: '.$_POST['scity'].'</td></tr>';
-
}
-
if(!empty($_POST['sstate']))
-
{
-
$message=$message. '<tr><td>State: '.$_POST['sstate'].'</td></tr>';
-
}
-
if(!empty($_POST['szip']))
-
{
-
$message=$message. '<tr><td>Zip/Postal Code: '.$_POST['szip'].'</td></tr>';
-
}
-
if(!empty($_POST['scountry']))
-
{
-
$message=$message. '<tr><td>Country: '.$_POST['scountry'].'</td></tr>';
-
}
-
$message=$message. '</table>';
-
-
$email_message .= $message.'</div></body></html>';
-
-
$message2 = '<html><body>'.$message;
-
$message2 .= '</body></html>';
-
-
$my_subject = 'Some Magazine Order';
-
-
$recipients = "'<someone1@example.com>, <someone2@example.com>, ";
-
$recipient = $_POST['bemail'];
-
-
-
$from_mail = "noreply@example.com";
-
// To send HTML mail, the Content-type header must be set
-
include('Mail.php');
-
include('Mail/mime.php');
-
-
-
$all_recipients = $recipients."<".$recipient.">'";
-
-
$html = $message2;
-
//$crlf = "rn";
-
$hdrs = array('From' => $from_mail,
-
'To' => $all_recipients,
-
'Subject' => $my_subject,
-
'Headers' => $hdrs
-
);
-
-
$mime = new Mail_mime();
-
// $mime->setTXTBody($text);
-
$mime->setHTMLBody($html);
-
// $mime->addAttachment($file,'application/octet-stream');
-
-
$body = $mime->get();
-
$hdrs = $mime->headers($hdrs);
-
$mail =& Mail::factory('mail', $params);
-
$mail->send($all_recipients, $hdrs, $body);
-
-
if (PEAR::isError($mail)) {
-
echo("<p>" . $mail->getMessage() . "</p>");
-
} else {
-
echo($email_message);
-
}
-
Here's the result: -
<tbody><tr><td>Thank you for ordering 1 year US subscription o=
-
f some Magazine</td></tr><tr><td>Billing Info</td></tr><tr><td>First Name=
-
: kronus</td></tr><tr><td>Last Name: agia</td></tr><tr><td>Company: fd</td>=
-
</tr><tr><td>Address 1: olympus</td></tr><tr><td>City: metro</td></tr><tr><=
-
td>State: California</tr><tr><td>Zip/Postal Code: 90004</td></tr><tr><=
-
td>Country: United States</tr><tr><td>Email: someemail@hotmail.com</td></tr><tr><td>Phone: 8185555555</td></tr><tr><td>Card number ending in: 510=
-
0</td></tr><tr><td>Country: United States</td></tr></tbody>
-
0 3210 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ,hj |
last post by:
From: ",hj" <webmaster@mail.com>
Subject: Losing random characters in HTML email
Date: 28 November 2003 17:21
I've narrowed down my code as much as I can so that I can show you this bug.
The reason the a's are there and not removed is because if I remove them the
problem doesn't show itself. It seems that there is a pattern and the nth
character does not show. Weird stuff.
|
by: dan glenn |
last post by:
I'm creating HTML emails from a PHP site and sending them out to an email
list (just about 40 people so far are on this list). I've tested and
confirmed that these emails work in yahoo.com's webmail. And I know they
work on *my* Outlook Express. But I have one person (I know of) who gets the
emails as plain text, so she sees the HTML code for the email instead of its
proper representation. She has, like myself, OE6, and other html emails...
|
by: Damien |
last post by:
Hi to all,
After hours of attempts and "googling", I'm still pulling my hair off my
head when I try to send multipart html emails.
It "works" on PCs with Outlook when I juste send a single "related"
mail: one part for the HTML body, and several for the images. However,
the images do not show on a Mac.
I also wanted to have an "alternate", plain text message. I've tried the
method described by Zend and PHPBuilder, but no luck...
|
by: lkrubner |
last post by:
When I had these two lines in my code:
if ($executed == "The command didn't exist") {
$this->core->error("In CommandRenderAllActionsInAnArray we sought
the command '$commandName' but ExteriorCommands could not find it. It
returned the value: '$executed'.", "CommandRenderAllActionsInAnArray");
|
by: John |
last post by:
Hi
I am using the following code to send html emails via outlook.
objOutlook = CreateObject("Outlook.Application")
objOutlookMsg = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
fso = CreateObject("Scripting.FileSystemObject")
ts = fso.OpenTextFile(m_objParentForm.txtHtml.Text.ToString, 1)
eMessage = ts.ReadAll
With objOutlookMsg
| |
by: Tappy Tibbons |
last post by:
We are writing a dotnet app that among other things retrieves messages from
a standard POP3 mailbox, and then performs certain actions with that email
automatically.
Some of the emails are coming in as HTML, which makes the email itself 8
times as large when it comes time to store it, as well as makes it
impossible to display to the user using any sort of standard dotnet control.
Is there a way to STRIP OUT all the html tags and get...
|
by: Dave G |
last post by:
Apologies if this has been covered before - I couldn't find it.
I currently use ASPEmail to create and send HTML emails from an Access
database. The text is personalised and includes embedded graphics, eg
logos and even the recipients photo. Note that everything is embedded,
no attachments are sent. ASPEmail works a treat but is very long winded
to create. The email designs come to me as finished HTML but I have to
extract the source and...
|
by: maya |
last post by:
hi,
I'm designing an HTML email for a client.. I know general guidelines
(no CSS, no JavaScript... although I do use limited CSS, inside tags (as
in <span style=".."we do this at work and it works fine, so I figured
it's ok..)
but I have a few more questions, for example, is it ok to do client-side
image-maps? is there a web page somewhere with general guidelines for
HTML e-mails? (and what is best way to test HTML e-mails? (I...
|
by: CJM |
last post by:
David,
Thanks for the reply.
Responses inline:
"David E. Ross" <nobody@nowhere.notwrote in message
news:OZadnaBdOMGpYb3VnZ2dnUVZ_vOdnZ2d@softcom.net...
This is a promotional mailshot so image is important. I understand what you
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |