Wierd issue - maybe buffer or memory related
Moderator: General Moderators
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
Wierd issue - maybe buffer or memory related
Ok, so I am have this code that sends a large amount of emails out. The emails get sent fine and all, but a few of the emails have display issues in the email client. It is wierd, so basically I have a list of server owners, and I loop through each one sending them an email that there server is getting patched.
If i echo that statement they display fine on the screen. But a few emails display html tags and wierd fonts.
Has anyone come across an issue like this before?
example: good
server1 needs reboot
example: bad
server1< /td> needs reboot
If i echo that statement they display fine on the screen. But a few emails display html tags and wierd fonts.
Has anyone come across an issue like this before?
example: good
server1 needs reboot
example: bad
server1< /td> needs reboot
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
Example email below: if you notice that the server ctmsahq0 2v has a space in its name. That space does not exist in the database or if I echo out the statement to the screen. I stored all this is a $message variable is there a max that one variable can store? Or should I be empty out some kind of buffer after each message?
Thanks for the help.
Notice:
Security related patches were released by Microsoft on September 12th and 26th. These patches were approved for installation on Windows servers Friday September 29th, and will apply on applicable server systems on the next reboot. Additional information on the patches is included at the end of this memo.
Action Required:
For systems with a scheduled reboot, please test the application after the reboot to ensure it is functioning properly.
For systems without a scheduled reboot, please perform a reboot in concordance with the applications normal maintenance procedure. After that reboot, please test the application to ensure it is functioning properly. Alternatively, if you would like to schedule an automatic weekly reboot, please let me know the time and date that the application and server can be restarted and I will configure it.
The applicable servers that show you as the point of contact are listed below.
Note: The alternate points of contact for these servers have also been notified.
Server Patch Group POC 1 POC 2 POC 3 Reboot Schedule
ctmsahq01v Production Servers
ctmsahq0 2v Production Servers
jssahq01 Production Servers
Additionally, click this link to see the report of all servers with you as the point of contact.
http://NetTools/PatchManagement
Additional Information:
Released September 26th:
Microsoft Security Bulletin MS06-049 - Updated
http://www.microsoft.com/technet/securi ... 6-049.mspx
Vulnerability in Windows Kernel Could Result in Elevation of Privilege (920958)
Article that describes the original patch problem can be found here: http://support.microsoft.com/kb/920958
Microsoft Security Bulletin MS06-055
http://www.microsoft.com/technet/securi ... 6-055.mspx
Vulnerability in Vector Markup Language Could Allow Remote Code Execution (925486)
Released September 12th:
Microsoft Security Bulletin MS06-052
http://support.microsoft.com/kb/KB919007
Vulnerability in Pragmatic General Multicast (PGM) Could Allow Remote Code Execution (919007)
Microsoft Security Bulletin MS06-053
http://support.microsoft.com/kb/920685
Vulnerability in Indexing Service Could Allow Cross-Site Scripting (920685)
Microsoft Security Bulletin MS06-054
http://support.microsoft.com/kb/910729
Vulnerability in Microsoft Publisher Could Allow Remote Code Execution (910729)
Microsoft Security Bulletin MS06-040 (Re-released)
http://support.microsoft.com/kb/921883
Vulnerability in Server Service Could Allow Remote Code Execution (921883)
Microsoft Security Bulletin MS06-042 (Re-released)
http://support.microsoft.com/kb/918899
Cumulative Security Update for Internet Explorer (918899)
Thanks for the help.
Notice:
Security related patches were released by Microsoft on September 12th and 26th. These patches were approved for installation on Windows servers Friday September 29th, and will apply on applicable server systems on the next reboot. Additional information on the patches is included at the end of this memo.
Action Required:
For systems with a scheduled reboot, please test the application after the reboot to ensure it is functioning properly.
For systems without a scheduled reboot, please perform a reboot in concordance with the applications normal maintenance procedure. After that reboot, please test the application to ensure it is functioning properly. Alternatively, if you would like to schedule an automatic weekly reboot, please let me know the time and date that the application and server can be restarted and I will configure it.
The applicable servers that show you as the point of contact are listed below.
Note: The alternate points of contact for these servers have also been notified.
Server Patch Group POC 1 POC 2 POC 3 Reboot Schedule
ctmsahq01v Production Servers
ctmsahq0 2v Production Servers
jssahq01 Production Servers
Additionally, click this link to see the report of all servers with you as the point of contact.
http://NetTools/PatchManagement
Additional Information:
Released September 26th:
Microsoft Security Bulletin MS06-049 - Updated
http://www.microsoft.com/technet/securi ... 6-049.mspx
Vulnerability in Windows Kernel Could Result in Elevation of Privilege (920958)
Article that describes the original patch problem can be found here: http://support.microsoft.com/kb/920958
Microsoft Security Bulletin MS06-055
http://www.microsoft.com/technet/securi ... 6-055.mspx
Vulnerability in Vector Markup Language Could Allow Remote Code Execution (925486)
Released September 12th:
Microsoft Security Bulletin MS06-052
http://support.microsoft.com/kb/KB919007
Vulnerability in Pragmatic General Multicast (PGM) Could Allow Remote Code Execution (919007)
Microsoft Security Bulletin MS06-053
http://support.microsoft.com/kb/920685
Vulnerability in Indexing Service Could Allow Cross-Site Scripting (920685)
Microsoft Security Bulletin MS06-054
http://support.microsoft.com/kb/910729
Vulnerability in Microsoft Publisher Could Allow Remote Code Execution (910729)
Microsoft Security Bulletin MS06-040 (Re-released)
http://support.microsoft.com/kb/921883
Vulnerability in Server Service Could Allow Remote Code Execution (921883)
Microsoft Security Bulletin MS06-042 (Re-released)
http://support.microsoft.com/kb/918899
Cumulative Security Update for Internet Explorer (918899)
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
Ok so it is kinda long, and bad html formatted by outlook. Really the only issue is with the html table. That is were the most of the issues are showing up.
Code: Select all
<html><head>
<style type=text/css>
BODY
{
FONT-FAMILY : helvetica,arial,verdana,sans-serif;
FONT-SIZE : 11px;
}
BODY.noscroll
{
FONT-FAMILY : helvetica,arial,verdana,sans-serif;
FONT-SIZE : 11px;
COLOR : #303030;
OVERFLOW-Y : hidden;
}
TR.titlerownew
{
FONT-FAMILY : helvetica,arial,verdana,sans-serif;
FONT-SIZE : 12px;
FONT-WEIGHT : bold;
BACKGROUND-color : gray;
COLOR : #FFFFFF;
}
TD.titlerow
{
BORDER-BOTTOM-COLOR : #ce6300;
BORDER-BOTTOM-WIDTH : 3px;
BORDER-BOTTOM-STYLE : solid;
COLOR : #FFFFFF;
CURSOR : hand;
}
TD.titlerow A:hover {
CURSOR : hand;
TEXT-DECORATION : underline;
}
TD.gray
{
FONT-WEIGHT : normal;
FONT-SIZE : 11;
COLOR : #505050;
BORDER-BOTTOM-COLOR : #e5e5e5;
BORDER-BOTTOM-WIDTH : 1px;
BORDER-BOTTOM-STYLE : solid;
}
</style></head><body><DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006><STRONG><U>Notice</U></STRONG>:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006>Security related
patches were released by Microsoft on September 12th and 26th. These
patches were approved for installation on Windows servers Friday September
29th, and will apply on applicable server systems on the next
reboot. Additional information on the patches is included at the end
of this memo.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=048093120-29092006><U><STRONG><FONT
color=#ff0000>Action Required</FONT></STRONG></U>:</SPAN></FONT></DIV>
<UL>
<LI><FONT face=Arial size=2><SPAN class=048093120-29092006>For systems
<EM>with</EM> a scheduled reboot, please test the application after the reboot
to ensure it is functioning properly. </SPAN></FONT></LI>
<LI><FONT face=Arial size=2><SPAN class=048093120-29092006>For systems
<EM>without</EM> a scheduled reboot, please perform a reboot in concordance
with the applications normal maintenance procedure. After that reboot,
please test the application to ensure it is functioning properly.
<U>Alternatively, if you would like to schedule an automatic weekly reboot,
please let me know the time and date that the application and server can be
restarted and I will configure it.</U></SPAN></FONT></LI></UL>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=048093120-29092006>The applicable
servers that show you as the point of contact are listed
below.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=048093120-29092006><u>Note</u>: The alternate points of contact for these servers have also been notified.</SPAN></FONT></DIV><br><br><table cellspacing=0><tr height=20 class=titlerownew><td class=titlerow align=left width=80>Server</td><td class=titlerow align=left width=120>Patch Group</td><td class=titlerow align=left width=80>POC 1</td><td class=titlerow align=left width=80>POC 2</td><td class=titlerow align=left width=80>POC 3</td><td class=titlerow align=left width=100>Reboot Schedule</td></tr><tr class=norow><td class=gray><a href=http://nettools/Serverlist/scripts/getserver.pl?server=wwwhr1 target=_blank>wwwhr1</a></td><td class=gray>Production Servers  </td><td class=gray>User</td><td class=gray>User</td><td class=gray>User</td><td class=gray>  </td></tr><tr class=norow><td class=gray><a href=http://nettools/Serverlist/scripts/getserver.pl?server=wwwhr2t target=_blank>wwwhr2t<
/a></td><td class=gray>Production Servers  </td><td class=gray>User</td><td class=gray>User</td><td class=gray>User</td><td class=gray>  </td></tr><tr class=norow><td class=gray><a href=http://nettools/Serverlist/scripts/getserver.pl?server=wwwhr2 target=_blank>wwwhr2</a></td><td class=gray>Production Servers  </td><td class=gray>User</td><td class=gray>User</td><td class=gray>User</td><td class=gray>Saturday 1:00 AM  </td></tr><tr class=norow><td class=gray><a href=http://nettools/Serverlist/scripts/getserver.pl?server=wwwhr target=_blank>wwwhr</a></td><td class=gray>Production Servers  </td><td class=gray>User</td><td class=gray>User</td><td class=gray>User</td><td class=gray>Sunday 3:00 AM  </td></tr></table><br><FONT face=Arial size=2>Additionally, click this link to see the report of all servers with you as the point of
contact.</font> <br><A href=http://NetTools/PatchManagement>http://NetTools/PatchManagement</A><br><DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006><STRONG><U>Additional
Information</U></STRONG>:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=048093120-29092006><U>Released
September 26th</U>:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style=MARGIN-RIGHT: 0px>
<DIV><FONT face=Arial><SPAN class=048093120-29092006><FONT size=2>Microsoft
Security Bulletin MS06-049 - Updated<BR></FONT><A
href=http://www.microsoft.com/technet/security/Bulletin/MS06-049.mspx><FONT
size=2>http://www.microsoft.com/technet/security/Bulletin/MS06-049.mspx</FONT></A><BR><FONT
size=2>Vulnerability in Windows Kernel Could Result in Elevation of Privilege
(920958)<BR>Article that describes the original patch problem can be found
here: </FONT><A href=http://support.microsoft.com/kb/920958><FONT
size=2>http://support.microsoft.com/kb/920958</FONT></A></SPAN></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face=Arial><SPAN class=048093120-29092006><FONT size=2>Microsoft
Security Bulletin MS06-055<BR></FONT><A
href=http://www.microsoft.com/technet/security/Bulletin/MS06-055.mspx><FONT
size=2>http://www.microsoft.com/technet/security/Bulletin/MS06-055.mspx</FONT></A><BR><FONT
size=2>Vulnerability in Vector Markup Language Could Allow Remote Code
Execution (925486)</FONT></SPAN></FONT></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial size=2><SPAN
class=048093120-29092006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=048093120-29092006><U>Released
September 12th</U>:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style=MARGIN-RIGHT: 0px>
<DIV><FONT face=Arial><SPAN class=048093120-29092006><FONT size=2>Microsoft
Security Bulletin MS06-052<BR></FONT><A
href=http://support.microsoft.com/kb/KB919007><FONT
size=2>http://support.microsoft.com/kb/KB919007</FONT></A><BR><FONT
size=2>Vulnerability in Pragmatic General Multicast (PGM) Could Allow Remote
Code Execution (919007)</FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial><SPAN
class=048093120-29092006>
<DIV><FONT size=2>Microsoft Security Bulletin MS06-053<BR></FONT><A
href=http://support.microsoft.com/kb/920685><FONT
size=2>http://support.microsoft.com/kb/920685</FONT></A><BR><FONT
size=2>Vulnerability in Indexing Service Could Allow Cross-Site Scripting
(920685)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Microsoft Security Bulletin MS06-054<BR></FONT><A
href=http://support.microsoft.com/kb/910729><FONT
size=2>http://support.microsoft.com/kb/910729</FONT></A><BR><FONT
size=2>Vulnerability in Microsoft Publisher Could Allow Remote Code Execution
(910729)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Microsoft Security Bulletin MS06-040
(Re-released)<BR></FONT><A href=http://support.microsoft.com/kb/921883><FONT
size=2>http://support.microsoft.com/kb/921883</FONT></A><BR><FONT
size=2>Vulnerability in Server Service Could Allow Remote Code Execution
(921883)</FONT></DIV>
<DIV><BR><FONT size=2>Microsoft Security Bulletin MS06-042
(Re-released)<BR></FONT><A href=http://support.microsoft.com/kb/918899><FONT
size=2>http://support.microsoft.com/kb/918899</FONT></A><BR><FONT
size=2>Cumulative Security Update for Internet Explorer
(918899)</FONT></SPAN></FONT></DIV></BLOCKQUOTE><br></body></html>
[quote][/quote]- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
While I'm not sure if this would fix the problem, you may want to stop using PHP's native mail() function and use a library like Swift Mailer.
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
here is the code that produces that table:
Code: Select all
$message .= "<tr class=norow><td class=gray><a href=http://nettools/Serverlist/scripts/getserver.pl?server=$row[server] target=_blank>$row[server]</a></td><td class=gray>$row[wsus_group]  </td><td class=gray>".getname($row['owner1'])." </td><td class=gray>".getname($row['owner2'])." </td><td class=gray>".getname($row['owner3'])." </td><td class=gray>$row[reboot]  </td></tr>";-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
LOL - I told you it was outlook. My boss formatted the email in outlook, we were in a hurry so I copied and pasted the formate from outlook into the $message variable. He was going to spend all night sending 1000 + emails in that format. But I would like to have this resolved because now that he knows something like this can be done he wants to automate it for patches every month. The bad outlook html would be reformatted, but that is not really where the problem is. Here are the mail headers.
Code: Select all
mail("$user@valero.com", $subject, $message,"From: $from\nBcc: $bcc\nContent-Type: text/html; charset=iso-8859-1");Ok, we talk at cross-purposes here. Let's start again.
I wanted you to save the mail in outlook, most probably (I don't have outlook anymore) by marking the email and then chose file->save mail/file/whatever. The result is a .eml file, containing the raw email data - just as outlook has received it, including the mail headers.
e.g. the latest ad mail I received from gmx
Take your time to create valid html.
e.g.create code that is accepted by http://validator.w3.org/
I wanted you to save the mail in outlook, most probably (I don't have outlook anymore) by marking the email and then chose file->save mail/file/whatever. The result is a .eml file, containing the raw email data - just as outlook has received it, including the mail headers.
e.g. the latest ad mail I received from gmx
I don't care about the mail headers. I just wanted to find out what exactly you did and what code we see here right now - is it something useful or something that may have been altered by another program.X-Account-Key: account1
X-UIDL: 7a442467d63ce85c69936ea3fdffc512
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: <mailings@gmx.net>
X-Flags: 0002
Date: Thu, 28 Sep 2006 10:20:08 GMT
From: GMX Best Price <mailings@gmx.net>
To: Alle Mitglieder von GMX <members@gmx.net>
Subject: 3,3% Superzins aufs Tagesgeld + Tankgutschein im Wert von 20,- Euro von Aral
Message-ID: <20060929203310.12485abod0@mmail05.gmx.net>
X-Priority: 3 (normal)
X-BBID: KW_39_2
X-BBArtikel: 3,3% Superzins aufs Tagesgeld
X-BBText: zusätzlich Tankgutschein im Wert von 20,- Euro von Aral
X-BBExpires: 20061002
X-GMX-HTML: 1
X-GMX-UID: UeZvZaFReSElayGvaXYhaXNyIGRvb4CO
X-GMX-Bulk: BestPrice_KW39_2_06
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="gmxboundary=-1159561990-12485-top"
--gmxboundary=-1159561990-12485-top
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Lieber Herr Krause,
[... ad mail ...]
Take your time to create valid html.
e.g.
Code: Select all
<?php
function getname($a) {
return $a;
}
$testdata = array(
array('server'=>'aServer', 'wsus_group'=>'a', 'owner1'=>'aOwner1', 'owner2'=>'aOwner2', 'owner3'=>'aOwner2', 'reboot'=>'y'),
array('server'=>'bServer', 'wsus_group'=>'b', 'owner1'=>'bOwner1', 'owner2'=>'bOwner2', 'owner3'=>'bOwner2', 'reboot'=>'y'),
array('server'=>'cServer', 'wsus_group'=>'c', 'owner1'=>'cOwner1', 'owner2'=>'cOwner2', 'owner3'=>'cOwner2', 'reboot'=>'y')
);
$message = '';
foreach($testdata as $row) {
$message .= ' <tr class="norow">
<td class="gray">
<a href="http://nettools/Serverlist/scripts/getserver.pl?server=' . urlencode($row['server']) . '">
' . htmlentities($row['server']) . '
</a>
</td>
<td class="gray">
' . htmlentities($row['wsus_group']) . '
</td>
<td class="gray">
' . getname($row['owner1']) . '
</td>
<td class="gray">
' . getname($row['owner2']) . '
</td>
<td class="gray">
' . getname($row['owner3']) . '
</td>
<td class="gray">
' . $row['reboot'] . '
</td>
</tr>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>html test</title>
</head>
<body>
<table>
<?php echo $message; ?>
</table>
</body>
</html>-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
Ok so the standard format that outlook stores messages in is .msg file. There are no options that I can see that give me what you ask. I tried to save the message as txt, html, unicode msg, msg, and outlook template. When I open all of these in notepad the top half is garbage. None of them produce any output like that of which you copied.
This does not happen for all messages only, a few. So are you thinking that the data returned may contain a space or something messing this up?
This does not happen for all messages only, a few. So are you thinking that the data returned may contain a space or something messing this up?
maybe yes. The output of my example has each attribute quoted, e.g.without quotes a server name with a space in it would break the href attribute up, e.g.a client would only recognize server=a and an empty(invalid) attribute Server.
Code: Select all
<a href="http://nettools/Serverlist/scripts/getserver.pl?server=aServer">Code: Select all
<a href=http://nettools/Serverlist/scripts/getserver.pl?server=a Server>-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm