osCommerce 2.2 RC2 Windows (Win32) and mail 501 5.5.4 Invalid Address

PHP contains bug in the Win32 code which prevents most php to work corrently with sending emails.

The overall idea of solution (workaround) is to do not use NAME with EMAILS. So both TO and FROM fields must be in form “TO: john@localhost.org” or “FROM: john@localhost.org” but not “TO: “John Doe” <john@localhost.org>”

I recently encountered this problem with osCommerce.

Solution to overcome this:

  1. I added define to both includes\configure.php and admin\includes\configure.phpdefine(‘WIN32’, true);

  2. Then in includes\classes\emails.php and admin\includes\classes\email.php in “send” function find this lines:$to = (($to_name != ”) ? ‘”‘ . $to_name . ‘” <‘ . $to_addr . ‘>’ : $to_addr);
    $from = (($from_name != ”) ? ‘”‘ . $from_name . ‘” <‘ . $from_addr . ‘>’ : $from_addr);

    and place following code BELOW them:

    //WIN32 FIX
    if (WIN32) {
    $from = $from_addr;
    $to = $to_addr;

That’s all, and now I can test email sending on my local win maching. Good luck!


October 1, 2008 at 10:22 pm 2 comments

Crystal Reports for Visual Studio 2003 and text cut/truncation in fields

Here is a problem: Crystal Reports for VS2003 by default truncates fields using word truncation strategy so if field has text “ABCD EFGHI” and only “ABCD EF” fits then “ABCD” will be displayed. Also we don’t need wrapping to next line.

So the solution is: replace common spaces with non-breakable ones.

string s = “ABCD EFGHI”;

string result = s.Replace(” “, (char) 0x00A0);

June 23, 2008 at 1:07 pm 4 comments

App_Data, App_Code and other App_* folder protection magic

Today I was asked question how ASP.NET protects this folders’ content from external access. ASP.NET does a little magic there with ISAPI filter aspnet_filter.dll, which you can see on IIS Manager\{Your PC Name}\Web Sites\ISAPI Filters tab.

WebDev.WebServer check this internally in WebDev.WebHost.dll

List of protected dirs: “/bin”, “/app_browsers”, “/app_code”, “/app_data”, “/app_localresources”, “/app_globalresources”, “/app_webreferences”.

April 2, 2008 at 12:58 pm 1 comment

CentOS 5, PHP, GD2 library

By default CentOS 5 comes without GD2 library for PHP

There is an easy fix for this with “yumagic” 🙂

Open terminal and run:

yum install php-gd

January 22, 2008 at 10:25 am 4 comments

Internet Explorer (IE) ignores white-space: nowrap on table’s TD

Used gridview today and client wanted content in tables to be displayed without any wrapping. First solution of course just set up:

<table><tr><td style=”white-space: nowrap”>qwe-asd</td></tr></table>

And of course it works fine both in Opera and FireFox but not in IE7 (have not tested under IE6). The picture changes of course but some cells are still wrapping.

Workaround is to use template field with span:

<table><tr><td><span style=”white-space: nowrap”>qwe-asd</span></td></tr></table>

January 15, 2008 at 10:41 am 65 comments

Code Coverage with TestDriven.Net in Visual Studio 2003

In VS2003 you can’t add your .exe to project reference of separate test assembly. So it is well known practice to copy it to some folder, rename to .dll and reference it from there. (Note: VS2005 allows you to reference .exe)

After performing such steps when you run Coverage from TestDriven.Net context menu, you can notice that there is coverage only for the test assembly.

Solution: Many chances you didn’t copy .pdb file for the .exe, but NCover can only profile assemblies which have .pdb files for them

October 30, 2007 at 11:22 am Leave a comment

Html attributes, single quote and HtmlAttributeEncode

When you develop your own custom controls do not forget that HtmlAttributeEncode method DOES NOT encode single quote.

MSDN says:

The string result from the HtmlAttributeEncode method should be used only for double-quoted attributes. Security issues might arise when using the HtmlAttributeEncode method with single-quoted attributes.

So you should use double quotes

September 11, 2007 at 11:33 am Leave a comment

Older Posts


  • .net

  • Feeds