custom emailer problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
king1033
Forum Newbie
Posts: 2
Joined: Sat Jul 10, 2004 11:31 pm

custom emailer problems

Post by king1033 »

Hi,
I am trying to create a custom emailer to go out to my email list. I am very new to php and I am probably skipping huge steps. But can anyone tell me if I had the right idea here in this snippet of code. Below, I tried making the $msg variable equal to html code. Then using it in the mail function. At first I had $msg simply equal a small sentence just to test it and that worked fine. I had a mock list of 5 addresses and they all received emails. But when I changed the sentence to my template code I received errors.

Thanks for your time,
Jason

Code: Select all

<?php
$fp = fopen("directory_where_my_list_is/list.txt","r");
while (!feof($fp))	{
$line = fgets($fp,1024);

$msg = //I was putting custom html here but was receiving errors

$recipient = $line;
$subject = "This weeks tag sale";
$mailheaders = " From <mysite@mysite.com> \n";
mail($recipient, $subject, $msg, $mailheaders);
}
echo "your emailer has been sent";

?>
The error I getting was:

Parse error: parse error in /usr/local/www/virtual3/66/175/39/31/html/emailer.php3 on line 38

where line 38 in my code was the first time I declared the $msg variable

Ok no Problem here is the exact html. It now actually goes through without any errors becuase of all the quotations I removed that dreamweaver puts in to the code. However the emails that go through show the source code. I am not any web designer by any means and I might just be over my head at this point. This is my 3rd or 4th day learning php. I Appreciate all the patience.

Code: Select all

<?php
$msg =  "<html>

<style type=text/css>
<!--
.title {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #990000;
	line-height: normal;
}
-->
</style>
<style type=text/css>
<!--
.text {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: normal;
	color: #666666;
}
.text2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #000000;
	font-weight: normal;
}
-->
</style>
</head>

<body>
<img src=http://www.mysite/images/header.jpg> <br>
<table width=790 border=0 cellpadding=0 cellspacing=8 bgcolor=#D2C515>
  <!--DWLayoutTable-->
  <tr> 
    <td width=790 height=1257 valign=top bgcolor=#FFFFFF><p>&nbsp;</p>
      <p align=center><span class=title>Franklin Lakes <br>
        232 Haven Road</span></p>
      <hr align=center width=550 size=1 noshade>
      <p align=enter> <span class=text>FROM 208 NORTH: 208 North to Colonial/High 
        Mountain Road Exit to Left on Colonial Road to Left on High Mountain Road 
        to Left on Haven Road to #232. </span></p>
      <p align=center class=text>FROM 208 SOUTH: 208 South to the Colonial/High 
        Mountain Road Exit to left onto High Mountain Road. Turn Left onto Haven 
        Road to #232</p>
      <p class=text2>French -style dining suite including a table with two leaves, 
        six chairs, and a sideboard, a three piece living room suite in a floral 
        pattern including a sofa, an easy chair, and a French-style caned back 
        accent chair, two faux mantels - one white-painted in a classical-style, 
        five piece oak dinette set, five piece white painted bedroom set, three 
        cushion plaid sofa, a futon, white painted bookcases, turn of the century 
        oak desk, gold and black painted iron king size headboard and footboard, 
        three drawer modern-style white painted dresser with large ring center 
        decoration, Ethan Allen boys bedroom set including a corner desk, bookcase 
        over chest, and a twin bed, a bentwood rocker, Queen Anne-style Bombay 
        card table, Chippendale-style wing chair signed Sherrill in peach tones, 
        pair of mahogany bergeres in striped fabric with green and peach tones, 
        a pair of Bombay Queen Anne-style mahogany end tables, vintage pine dough 
        box table, Hickory Chippendale -style chair, camelback sofa and loveseat 
        in a floral pattern, turn of the century oak bookcase with four shelves, 
        wrought iron daybed, blonde five- drawer chest signed McGraw Edison, kitchen 
        storage cabinets, nice accent furniture, etc.</p>
      <p class=text2>Many rugs including a carved Chinese room size rug in green 
        and rust tones, mirrors, lot of really nice decorations and decorative 
        artwork, nice ladies clothing & shoes and lots of hats - in petite 
        sizes, Sony television and VCR, air conditioners, etc.</p>
      <p></p></td>
  </tr>
</table>
</body>
</html>"?>
Last edited by king1033 on Thu Jul 15, 2004 12:11 am, edited 3 times in total.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Can you post the errors?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

we'll need to see this custom html...
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Yeah, you probably didn't escape a quotation mark or something to tha effect in your custom HTML code. If you post it, we can fix it up for you.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

to fix the source code showing, you need to set the content-type for the mail: Sending HTML email Note: This link jumps into the middle of the thread..
Post Reply