Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unusual error with Sendmail 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
If a user enters a badly formed email address ie. yyrtrt@.gdgdg
I get the error

Code:
error closing /usr/lib/sendmail:  (exit 256)

Any idea how to deal with it?

Keith
 
Validate before invoking sendmail is the only way.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks Chris, I test for the presence of a period and @ but obviously not enough.
I have tested my other servers and also shared hosting and the problem is only on one particular server.

Keith
 
I usually check for characters before and after the '.'

(\S+)@(\S+)\.(\S+)$ in it's simplest reg exp form

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks, assistance as always much appreciated.
I contacted my ISP but got the usual BS back about the server being unmanaged.

I only discovered the problem by accident, when testing the form.
I was entering nonsense to check some other functions and got this odd error.
It only does it when '@' and '.' are together. If that is the case, I remove them both and my validation fails the submission any way.



Keith
 
@. is an invalid character sequence for the Internet Mail RFCs

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
You may want to look @
It is apparently considered bad practice to try to roll your own regex to validate things such as email addresses. [nosmiley]



"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
The check I do is only very basic and is designed to filter out keyboard bashing rather than validate an actual address.
A simple substitution of @. solved the original problem.
Not handling it resulted in a fatal error being thrown and the script crashed, which was unacceptable.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top