Community Discussions and Support
Unbalanced <

I can happily send mail using the PHP mail() function and File > Send mail message but I have an open source application (osCommerce) which when it sends an email a message comes back with

   --- Problems not related to specific addresses in the message:
   553 5.0.0 <Lils <mail@xxxxxx.co.uk> SIZE=523... Unbalanced '<'
   ***  <graham@xxxxxx.co.uk

 The specification for the email addresses looks okay and I've tried various options "Lils Warehouse" <mail@xxxxxx.co.uk> Lils <mail@xxxxxx.co.uk> and just mail@xxxxxx.co.uk without success.

I know the problem might well lie with osCommerce but since I've not changed anything there and there are no known issues around this I'm wondering if my mail server setup is missing something. I'm using just MercuryS and MercuryC.

Any pointers much appreciated. 

&lt;p&gt;I can happily send mail using the PHP mail() function and File &amp;gt; Send mail message but I have an open source application (osCommerce) which when it sends an email a message comes back with &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; --- Problems not related to specific addresses in the message: &amp;nbsp;&amp;nbsp; 553 5.0.0 &amp;lt;Lils &amp;lt;mail@xxxxxx.co.uk&amp;gt; SIZE=523... Unbalanced &#039;&amp;lt;&#039; &amp;nbsp;&amp;nbsp; ***&amp;nbsp; &amp;lt;graham@xxxxxx.co.uk &lt;/p&gt;&lt;p&gt;&amp;nbsp;The specification for the email addresses looks okay and I&#039;ve tried various options &quot;Lils Warehouse&quot; &amp;lt;mail@xxxxxx.co.uk&amp;gt; Lils &amp;lt;mail@xxxxxx.co.uk&amp;gt; and just mail@xxxxxx.co.uk without success. &lt;/p&gt;&lt;p&gt;I know the problem might well lie with osCommerce but since I&#039;ve not changed anything there and there are no known issues around this I&#039;m wondering if my mail server setup is missing something. I&#039;m using just MercuryS and MercuryC.&lt;/p&gt;&lt;p&gt;Any pointers much appreciated.&amp;nbsp;&lt;/p&gt;

The characters < and > must only be used around the real email address, and must be matched. In your example it should be:

Lils <mail@xxxxxx.co.uk>

 If for some reason you really really want to use an extra < in the descriptive part of the address you need to quote it:

"<Lils" <mail@xxxxxx.co.uk>

As you have tested a lot of options it seems likely it's a bug in the osCommerce application.

 /Rolf

 

&lt;p&gt;The characters &amp;lt; and &amp;gt; must only be used around the real email address, and must be matched. In your example it should be:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;Lils &amp;lt;mail@xxxxxx.co.uk&amp;gt; &lt;/i&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;If for some reason you really really want to use an extra &amp;lt; in the descriptive part of the address you need to quote it:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&quot;&amp;lt;Lils&quot; &lt;i&gt;&amp;lt;mail@xxxxxx.co.uk&amp;gt;&lt;/i&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;As you have tested a lot of options it seems likely it&#039;s a bug in the osCommerce application. &lt;/p&gt;&lt;p&gt;&amp;nbsp;/Rolf &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;

Thanks Rolf. I've noticed I get two returned emails and the 2nd has

To: Lils <mail@xxxxxx.co.uk

which seems to confirm your suspicion. Finding the error is going to be interesting...

Cheers
 

&lt;p&gt;Thanks Rolf. I&#039;ve noticed I get two returned emails and the 2nd has&lt;/p&gt;&lt;p&gt;To: Lils &amp;lt;mail@xxxxxx.co.uk&lt;/p&gt;&lt;p&gt;which seems to confirm your suspicion. Finding the error is going to be interesting...&lt;/p&gt;&lt;p&gt;Cheers &amp;nbsp;&lt;/p&gt;

We're also using osCommerce and you can get this problem if a customer/user enters their personal adress the wrong way. So it may not necessarily be inte the code that you have an error.

We&#039;re also using osCommerce and you can get this problem if a&amp;nbsp;customer/user enters their personal adress the wrong way. So it may not necessarily be inte the code that you have an error.

Thanks Peter. That's useful to know, although in this case it's the store owner's email that's causing the problem and I can't see anything wrong with the email format - unless osCommerce can't handle .co.uk email addresses...

Thanks Peter. That&#039;s useful to know, although in this case it&#039;s the store owner&#039;s email that&#039;s causing the problem and I can&#039;t see anything wrong with the email format - unless osCommerce can&#039;t handle .co.uk email addresses...

I have discovered that the problem is with my Mercury setup. If the format of the email address is User name <user@example.com> or "User name" <user@example.com> then it fails with unbalanced < but if I omit the User and the <> and just put the email address it works fine. Don't know if that's me or Mercury...

I have discovered that the problem is with my Mercury setup. If the format of the email address is User name &amp;lt;user@example.com&amp;gt; or &quot;User name&quot; &amp;lt;user@example.com&amp;gt; then it fails with unbalanced &amp;lt; but if I omit the User and the &amp;lt;&amp;gt; and just put the email address it works fine. Don&#039;t know if that&#039;s me or Mercury...

I understood that the problem was that an address in a SMTP transaction (when osCommerce connects to Mercury) caused an error. If this is not the case, please let us know where in Mercury the address is entered.

 /Rolf
 

&lt;p&gt;I understood that the problem was that an address in a SMTP transaction (when osCommerce connects to Mercury) caused an error. If this is not the case, please let us know where in Mercury the address is entered.&lt;/p&gt;&lt;p&gt;&amp;nbsp;/Rolf &amp;nbsp;&lt;/p&gt;

Sorry if I have confused things! I have a problem with osCommerce causing an email failure (unbalanced <). In trying various other things I have discovered that any email sent through Mercury - I've also tried a simple PHP mail() - with an email address in the format "User name" <mail@xxx.com> fails but emails with an email address in the format mail@xxx.com seem to be okay. Does that mean my problem lies with the mail server?

Is there a setting in Mercury to allow emails in the format "User name" <mail@xxx.com>?

Thanks
 

&lt;p&gt;Sorry if I have confused things! I have a problem with osCommerce causing an email failure (unbalanced &amp;lt;). In trying various other things I have discovered that any email sent through Mercury - I&#039;ve also tried a simple PHP mail() - with an email address in the format &quot;User name&quot; &amp;lt;mail@xxx.com&amp;gt; fails but emails with an email address in the format mail@xxx.com seem to be okay. Does that mean my problem lies with the mail server? &lt;/p&gt;&lt;p&gt;Is there a setting in Mercury to allow emails in the format &quot;User name&quot; &amp;lt;mail@xxx.com&amp;gt;?&lt;/p&gt;&lt;p&gt;Thanks &amp;nbsp;&lt;/p&gt;

[quote user="gandalf458"]Is there a setting in Mercury to allow emails in the format "User name" <mail@xxx.com> ? [/quote]

Are you referring to the SMTP commands or the From: and To: lines within the mail?  In SMTP that address is invalid - you can only use name@domain.com .  See the examples at the end of rfc2821 for clarification.

Within the headers of the email, you can use the display name format.  If the application only allows one entry of the address, and doesn't reduce it to the 'angle-addr' form for SMTP commands, the you will have to use the simple address format.

&lt;P&gt;[quote user=&quot;gandalf458&quot;]Is there a setting in Mercury to allow emails in the format &quot;User name&quot; &amp;lt;mail@xxx.com&amp;gt; ? [/quote]&lt;/P&gt; &lt;P&gt;Are you referring to the SMTP commands or the From: and To: lines within the mail?&amp;nbsp; In SMTP that address&amp;nbsp;is invalid - you can only use name@domain.com&amp;nbsp;.&amp;nbsp; See the examples at the end of rfc2821 for clarification.&lt;/P&gt; &lt;P&gt;Within the headers of the email, you can use the display name format.&amp;nbsp; If the application only allows one entry of the address, and doesn&#039;t reduce it to the &#039;angle-addr&#039; form for SMTP commands, the you will have to&amp;nbsp;use the simple address format.&lt;/P&gt;

Thanks for explaining. I was referring to the parameters in mail ($to, $from, $message, etc...). Since it's illegal that accounts for my problem and confirms that I need to get the application code sorted.

Many thanks. G :)
 

&lt;p&gt;Thanks for explaining. I was referring to the parameters in mail ($to, $from, $message, etc...). Since it&#039;s illegal that accounts for my problem and confirms that I need to get the application code sorted.&lt;/p&gt;&lt;p&gt;Many thanks. G :) &amp;nbsp;&lt;/p&gt;

[quote user="gandalf458"]I have discovered that the problem is with my Mercury setup. If the format of the email address is User name <user@example.com> or "User name" <user@example.com> then it fails with unbalanced < but if I omit the User and the <> and just put the email address it works fine. Don't know if that's me or Mercury...
[/quote]

suspect you're referring to the admin pages of osCommerce - I'll test this. We're using a separate email component with osCommerce that has a queing feature. I'll talk to my osC person tomorrow about this.

&lt;P&gt;[quote user=&quot;gandalf458&quot;]I have discovered that the problem is with my Mercury setup. If the format of the email address is User name &amp;lt;user@example.com&amp;gt; or &quot;User name&quot; &amp;lt;user@example.com&amp;gt; then it fails with unbalanced &amp;lt; but if I omit the User and the &amp;lt;&amp;gt; and just put the email address it works fine. Don&#039;t know if that&#039;s me or Mercury... [/quote]&lt;/P&gt; &lt;P&gt;suspect you&#039;re referring to the admin pages of osCommerce - I&#039;ll test this. We&#039;re using a separate email component with osCommerce that has a queing feature. I&#039;ll talk to my osC person tomorrow about this.&lt;/P&gt;

Thanks, Peter. I'm quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...

Graham
 

&lt;p&gt;Thanks, Peter. I&#039;m quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...&lt;/p&gt;&lt;p&gt;Graham &amp;nbsp;&lt;/p&gt;

[quote user="gandalf458"]

Thanks, Peter. I'm quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...

Graham
 

[/quote]

 

Turn on session logging in MercuryS and then send a message via osC.  Look at the session log to see what osC is sending to the system.  The MAIL FROM: address should be a simple SMTP email address in the form <user@domain.com>, the RCPT TO: address also should be in the form <user@domain.com>. I suspect you will find one of these at least in the wrong format.

The actual From: address in the message can have a personal name added to the email address but this format is specified in RFC 2821 as "Name" <email@address>, Name <email@address>, or email.address (Name).  MercuryS does not even check this for proper format and core will not either if you check Configuration | Mercury core "Suppress validation of From field when processing mail" 

 

[quote user=&quot;gandalf458&quot;]&lt;p&gt;Thanks, Peter. I&#039;m quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...&lt;/p&gt;&lt;p&gt;Graham &amp;nbsp;&lt;/p&gt;&lt;p&gt;[/quote]&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Turn on session logging in MercuryS and then send a message via osC.&amp;nbsp; Look at the session log to see what osC is sending to the system.&amp;nbsp; The MAIL FROM: address should be a simple SMTP email address in the form &amp;lt;user@domain.com&amp;gt;, the RCPT TO: address also should be in the form &amp;lt;user@domain.com&amp;gt;. I suspect you will find one of these at least in the wrong format. &lt;/p&gt;&lt;p&gt;The actual From: address in the message can have a personal name added to the email address but this format is specified in RFC 2821 as &quot;Name&quot; &amp;lt;email@address&amp;gt;, Name &amp;lt;email@address&amp;gt;, or email.address (Name).&amp;nbsp; MercuryS does not even check this for proper format and core will not either if you check Configuration | Mercury core &quot;Suppress validation of From field when processing mail&quot;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

Thanks Thomas. I have

MAIL FROM:<"Lilly Bolero" <xxx@mail.com>><cr><lf>

and

RCPT TO:<xxx@mail.com><cr><lf>

&lt;p&gt;Thanks Thomas. I have &lt;/p&gt;&lt;p&gt;MAIL FROM:&amp;lt;&quot;Lilly Bolero&quot; &amp;lt;xxx@mail.com&amp;gt;&amp;gt;&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;and&lt;/p&gt;&lt;p&gt;RCPT TO:&amp;lt;xxx@mail.com&amp;gt;&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt; &lt;/p&gt;

[quote user="gandalf458"]MAIL FROM:<"Lilly Bolero" <xxx@mail.com>><cr><lf>[/quote]

This is the problem.

Is OSc putting in the outer brackets <> ?  If so, try entering this address as just xxx@mail.com

&lt;P&gt;[quote user=&quot;gandalf458&quot;]MAIL FROM:&amp;lt;&quot;Lilly Bolero&quot; &amp;lt;xxx@mail.com&amp;gt;&amp;gt;&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;[/quote]&lt;/P&gt; &lt;P&gt;This is the problem.&lt;/P&gt; &lt;P&gt;Is OSc putting in the outer brackets &amp;lt;&amp;gt; ?&amp;nbsp; If so, try entering this address as just &lt;A href=&quot;mailto:xxx@mail.com&quot;&gt;xxx@mail.com&lt;/A&gt;&lt;/P&gt;

[quote user="gandalf458"]

Thanks Thomas. I have

MAIL FROM:<"Lilly Bolero" <xxx@mail.com>><cr><lf>

and

RCPT TO:<xxx@mail.com><cr><lf>

[/quote]

 

The MAIL FROM: address should be only  <xxx@mail.com>, no personal name.  Check the osC settings.

 

[quote user=&quot;gandalf458&quot;]&lt;p&gt;Thanks Thomas. I have &lt;/p&gt;&lt;p&gt;MAIL FROM:&amp;lt;&quot;Lilly Bolero&quot; &amp;lt;xxx@mail.com&amp;gt;&amp;gt;&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;and&lt;/p&gt;&lt;p&gt;RCPT TO:&amp;lt;xxx@mail.com&amp;gt;&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt; &lt;/p&gt;&lt;p&gt;[/quote]&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The MAIL FROM: address should be only&amp;nbsp; &amp;lt;xxx@mail.com&amp;gt;, no personal name.&amp;nbsp; Check the osC settings.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

[quote user="gandalf458"] Thanks, Peter. I'm quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...[/quote]

We use PHP Mailer as you see from the headers below.
It parses the Store Owner with Mail Address correctly as "Store Owner" <Mail Address>
You simply enter:
Store Owner: MyStore
Mail Address: order@mystore.com
and you'll get the below results: 

From: MyStore <order@mystore.com>
Subject: Orderstatus
Message-ID: <a3e81bba3f8ead2b70acffad29b144d6@mystore.com>
X-Priority: 3
X-Mailer: PHPMailer [version 1.73]
&lt;P&gt;[quote user=&quot;gandalf458&quot;] Thanks, Peter. I&#039;m quite confused now as to where the problem lies now. Obviously osC works for most people, so does Mercury...[/quote]&lt;/P&gt; &lt;P&gt;We use PHP Mailer as&amp;nbsp;you see from the headers below. It parses the Store Owner with Mail Address correctly as &quot;Store Owner&quot; &amp;lt;Mail Address&amp;gt; You simply enter: Store Owner: MyStore Mail Address:&amp;nbsp;order@mystore.com and you&#039;ll get the below results:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;From:&amp;nbsp;MyStore &amp;lt;order@mystore.com&amp;gt; Subject: Orderstatus Message-ID: &amp;lt;a3e81bba3f8ead2b70acffad29b144d6@mystore.com&amp;gt; X-Priority: 3 X-Mailer: PHPMailer [version 1.73] &lt;/PRE&gt;

I thought that was coming! ;)

Yes, osC adds the name and the outer <> and it's not one of the settings I can change. Guess I could get in to the PHP and change it - if I could find it.

No one on the osC forum seems to have experience with Mercury but I should have thought other SMTP servers would have trouble with this as well. 

I'm told there is an osC contribution to enable SMTP authentication via my ISP.

I appreciate your help guys. I'm learning a lot about mail servers!
 

&lt;p&gt;I thought that was coming! ;)&lt;/p&gt;&lt;p&gt;Yes, osC adds the name and the outer &amp;lt;&amp;gt; and it&#039;s not one of the settings I can change. Guess I could get in to the PHP and change it - if I could find it.&lt;/p&gt;&lt;p&gt;No one on the osC forum seems to have experience with Mercury but I should have thought other SMTP servers would have trouble with this as well.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&#039;m told there is an osC contribution to enable SMTP authentication via my ISP.&lt;/p&gt;&lt;p&gt;I appreciate your help guys. I&#039;m learning a lot about mail servers! &amp;nbsp;&lt;/p&gt;

Thanks Peter. Do I need to do anything within Mercury or osC to use PHPMailer?

Thanks Peter. Do I need to do anything within Mercury or osC to use PHPMailer?
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft