Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 6th, 2012, 01:34 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default Syntactically invalid EHLO argument(s)

Re: Chapter 9 Sending Email Messages.

Hi All,

I need some help once again. I have currently created the contact us form as per chapter 9 of the book and coded the Web.config, smtpClient and MailMessage as per the book to send email from the website. The smtp server that I am using is provided by 123-reg.co.uk and when I try to send an email to the smtp server I get the message:-

" Syntax error in parameters or arguments. The server response was: Syntactically invalid EHLO argument(s)"

Thinking that this was something to do with my coding I change the smtp server configuration to use the googlemail smtp server and this works great without the syntax error above.

Does anyone know what this error is and what could be causing me to get the error with the way we have coded the mail components as per the book?

Thanks to anyone who may be able to help.

Kind regards,

Ian Ryder
  #2 (permalink)  
Old April 6th, 2012, 03:14 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Does your machine name contain an underscore? I have seen some posts where that was an issue. Otheriwse, this Google search may bring up some useful stuff:

https://www.google.com/?q=Syntax+err...HLO+argument(s)

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old April 6th, 2012, 03:51 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi Imar,

Thanks for your note. I had checked all these sources this morning before I added this thread and I did not really get any helpful hints. The only thing that I can think off at the moment, which has any relation to these posts, is the hyphen in the host name. The full host name being "smtp.123-reg.co.uk", but even if it is this, there are no explanations as to how this can be handled?

A bit stuck on this one for the moment.

Kind regards,

Ian
  #4 (permalink)  
Old April 6th, 2012, 03:53 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

If the hypen is indeed the issue I don't think it can be handled.

But do you have an underscore in the name of your machine? E.g. the machine you're sending from, not to?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old April 6th, 2012, 04:02 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi Imar,

My misunderstanding. Actually yes it does my machine name is "Ian_AW_VAIO". Could this be the issue?

Ian
  #6 (permalink)  
Old April 6th, 2012, 04:25 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Ian,

I never ran into this issue so I am not 100% sure; however, some posts such as the one on StackOverflow seem to suggest this could indeed be the case.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Ian Ryder (April 6th, 2012)
  #7 (permalink)  
Old April 6th, 2012, 10:01 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi Imar,

Sorry for the delay in responding and after a long frustrating morning I can finally give you my findings. Hopefully this may help someone else in the future.

If anyone has had this error then please read my whole experience - it could be useful?

1) After your comment that my own machine name could be causing the problem by having underscores in it (being "Ian_VW_VAIO"), I changed my machine name to remove the underscores ending in ("IanVWVaio" ). This did indeed did solve the error and I no longer got "Syntax error in parameters or arguments. The server response was: Syntactically invalid EHLO argument(s)" when running the send email code from the book.

2) That said, everything looked fine, I got no errors from the webpage and Message Sent was displayed as expected (i.e. VB code executed successfully). Unfortunately, no email arrived in the inbox of the recipient of the email? Confusing?

3) After investigation with 123-reg.co.uk who is my service provider I gained the knowledge that they did not support what they called "Scripting from Contact Forms" as per, what I am assuming you have in the book, but they did offer an ASP scripting example which did work with them? After trying their own scripting code it was a total red herring and I got nothing but "Error: The transport failed to connect to the server. (-2147220973)"

4) After this, I got fed up with the 123-reg smtp host and decided that I needed another smtp solution to work with the site. I therefore created a new pop3 email account with GMail, knowing that my previous goolemail account worked fine with the components in the book. After the account was setup I configured MS Outlook to send and receive emails from the gmail account to verify validity. This worked fine so I knew the account was setup correctly. Amongst the usual settings the smtp port used for the outgoing mail was configured as 465. I transferred all this information back to the Web.config file in the website and clicked the send button. After a few seconds I then got "Internet Explorer Cannot Display the Webpage", i.e. the page timed out.

5) After investigating "ASP.NET Contact Forms with Gmail" on the net I came across a site with a similar coding example for sending email using GMail with ASP. The only major difference in their coding was the port they were using to connect to which was 587.

6) Bingo! everything works, but what a headache!

In summary,

If you have underscores in your own computer name then remove them. Note that not all email providers generate the syntax error as discussed in this thread since googlemail works fine with underscores in your computer name?

If you use 123-reg.co.uk to host your email then use a different email provider to send your email from your site. As at this point 123-reg.co.uk simply does not allow you to script to their SMTP server.

If you use GMail to host your email address then do not use the standard SMPT port of 465 to send messages form your site. You must use port 587.

Thanks once again Imar for putting me on the right track. Its been a headache but we got there in the end.

Time to get back to studying the book again so talk to you again soon.

Kindest regards,

Ian
  #8 (permalink)  
Old April 7th, 2012, 04:51 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Ian,

Thanks for your follow up on this; much appreciated.

Quote:
what they called "Scripting from Contact Forms" as per, what I am assuming you have in the book, but they did offer an ASP scripting example which did work with them?
That sounds odd; both should work on more or less the same way: a web site that wants to connect to an SMTP server to drop an e-mail. Not sure why they would say they support one but not the other technology.
Quote:

The only major difference in their coding was the port they were using to connect to which was 587.
Yes, that's what Gmail seems to use. You find a reference to it on page 318, but unfortunately not directly in the Gmail example. I'll fix that for the ASP.NET 4.5 version of the book.

Quote:
Thanks once again Imar for putting me on the right track. Its been a headache but we got there in the end.
You're more than welcome, and thank you for reporting back your findings.

Quote:
to get back to studying the book again so talk to you again soon.
Good luck and have fun.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid argument supplied for foreach() codejockey Beginning PHP 4 September 24th, 2010 03:40 AM
Invalid postback or callback argument mallikalapati ASP.NET 2.0 Professional 4 February 20th, 2008 08:38 AM
Invalid Argument ppenn Access VBA 2 May 14th, 2007 10:11 AM
Invalid postback or callback argument. kingw BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 January 1st, 2007 09:49 PM
Invalid Argument.... baNTON Access VBA 4 April 27th, 2004 06:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.