Pipelining falls under ESMTP specs as far as I know and the only reason EHLO was called is to confirm pipelining support. The reason I didn't make ESMTP a config option was because pipelining is the only command sent that needs to establish a ESMTP session using EHLO.
Unless you are saying the pipelining is not working. But I am unclear as to what you are trying to convey. Can you elaborate on the problem or request?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As a stop gap, we instituted the following source was added:
internal string_handshakeMethod = "HELO";
/// <summary>
/// Method of contacting relay server (EHLO, HELO)
/// </summary>
public string HandshakeMethod
{
get
{
return _handshakeMethod;
}
set
{
// Thrown in for users that desire this method of setting.
if ((value != "HELO") && (value != "EHLO"))
{
throw new ImproperHandshakeException("Only values HELO and EHLO are valid");
}
else
{
_handshakeMethod = value;
}
}
}
/// <summary>
/// Enumeration of server handshake methods. This value corresponds to the valid handshake methods used by the property HandshakeMethod.
/// </summary>
public enum enmHandshakeMethod
{
HELO = 0 // Standard Hello
, EHLO = 1 // Extended Hello
}
/// <summary>
/// Construct an Smtp object with a handshake method. The default is to use HELO.
/// </summary>
/// <param name="handshakeMethod">Enum: 0 = HELO; 1 = EHLO</param>
public Smtp(enmHandshakeMethod handshakeMethod)
{
switch (handshakeMethod)
{
// HELO - default
case enmHandshakeMethod.HELO:
_handshakeMethod = "HELO";
break;
// EHLO - Extended Hello
case enmHandshakeMethod.EHLO:
_handshakeMethod = "EHLO";
break;
default:
// Error if values other than 0 or 1 are sent (enum).
throw new ImproperHandshakeException("Must pass values from the Handshake Method enum.");
}
}
And the following changed from:
WriteToStream(ref nwstream, "HELO " + host + "\r\n");
Ahh, I see the problem now and will address this in the next release. Thank you for your patience.
We have been working on a new release, basically we are rewriting the component to be more robust and flexible to accomodate not just SMTP but POP3, IMAP4, NNTP, etc. This should be released somtime this summer.
In the meantime before that is released I will update Opensmtp.net and fix what was stated above. Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Keep it simple, stupid"
Not confuse pipeline with ESMP support.
I rewrite method SendMail in class SMTP:
public void SendMail(MailMessage msg){
if (SmtpConfig.esmtp){
SendMailESMTP(msg);
}else{
SendMailSMTP(msg);
}
}
And add this two private methods:
private void SendMailSMTP(MailMessage msg)
{
NetworkStream nwstream = GetConnection();
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.HELO_REPLY);
WriteToStream(ref nwstream, "HELO " + host + "\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
WriteToStream(ref nwstream, "MAIL FROM: <" + msg.from.address + ">\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
SendRecipientList(ref nwstream, msg.recipientList);
SendRecipientList(ref nwstream, msg.ccList);
SendRecipientList(ref nwstream, msg.bccList);
WriteToStream(ref nwstream, "DATA\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.START_INPUT);
OnStartedMessageTransfer(EventArgs.Empty);
WriteToStream(ref nwstream, msg.ToString() + "\r\n.\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
OnEndedMessageTransfer(EventArgs.Empty);
WriteToStream(ref nwstream, "QUIT\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.QUIT);
CloseConnection();
}
private void SendMailESMTP(MailMessage msg)
{
NetworkStream nwstream = GetConnection();
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.HELO_REPLY);
WriteToStream(ref nwstream, "EHLO " + host + "\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
// Authentication is used if the u/p are supplied
AuthLogin(ref nwstream);
WriteToStream(ref nwstream, "MAIL FROM: <" + msg.from.address + ">\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
SendRecipientList(ref nwstream, msg.recipientList);
SendRecipientList(ref nwstream, msg.ccList);
SendRecipientList(ref nwstream, msg.bccList);
WriteToStream(ref nwstream, "DATA\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.START_INPUT);
OnStartedMessageTransfer(EventArgs.Empty);
WriteToStream(ref nwstream, msg.ToString() + "\r\n.\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);
OnEndedMessageTransfer(EventArgs.Empty);
WriteToStream(ref nwstream, "QUIT\r\n");
CheckForError(ReadFromStream(ref nwstream), ReplyConstants.QUIT);
CloseConnection();
}
No pipeline support, (optimization at last) but its works.
Good job, Congratulations, its too usefull for me,
(i don't like license change)
Pipelining falls under ESMTP specs as far as I know and the only reason EHLO was called is to confirm pipelining support. The reason I didn't make ESMTP a config option was because pipelining is the only command sent that needs to establish a ESMTP session using EHLO.
Unless you are saying the pipelining is not working. But I am unclear as to what you are trying to convey. Can you elaborate on the problem or request?
>>ESMTP a config option was because pipelining >>is the only command sent that needs to >>establish a ESMTP session using EHLO
mmm NO, (at least in the smtp server i test, smtp.telefonica.net)
It cant accept AUTH request if you dont use EHLO
Also, i think AUTH is part of the ESMTP and its no included in SMTP.
>>Unless you are saying the pipelining is not >>working??
Dont work if you send two or more cc address
As a stop gap, we instituted the following source was added:
internal string_handshakeMethod = "HELO";
/// <summary>
/// Method of contacting relay server (EHLO, HELO)
/// </summary>
public string HandshakeMethod
{
get
{
return _handshakeMethod;
}
set
{
// Thrown in for users that desire this method of setting.
if ((value != "HELO") && (value != "EHLO"))
{
throw new ImproperHandshakeException("Only values HELO and EHLO are valid");
}
else
{
_handshakeMethod = value;
}
}
}
/// <summary>
/// Enumeration of server handshake methods. This value corresponds to the valid handshake methods used by the property HandshakeMethod.
/// </summary>
public enum enmHandshakeMethod
{
HELO = 0 // Standard Hello
, EHLO = 1 // Extended Hello
}
/// <summary>
/// Construct an Smtp object with a handshake method. The default is to use HELO.
/// </summary>
/// <param name="handshakeMethod">Enum: 0 = HELO; 1 = EHLO</param>
public Smtp(enmHandshakeMethod handshakeMethod)
{
switch (handshakeMethod)
{
// HELO - default
case enmHandshakeMethod.HELO:
_handshakeMethod = "HELO";
break;
// EHLO - Extended Hello
case enmHandshakeMethod.EHLO:
_handshakeMethod = "EHLO";
break;
default:
// Error if values other than 0 or 1 are sent (enum).
throw new ImproperHandshakeException("Must pass values from the Handshake Method enum.");
}
}
And the following changed from:
WriteToStream(ref nwstream, "HELO " + host + "\r\n");
to:
WriteToStream(ref nwstream, _handshakeMethod + " " + host + "\r\n");
Not very elegant, nor properly architected. But, it solves an issue with having to use EHLO for one of our apps.
If there is something more elegant already included in the component that we missed, I would much rather stick with the original source.
Ahh, I see the problem now and will address this in the next release. Thank you for your patience.
We have been working on a new release, basically we are rewriting the component to be more robust and flexible to accomodate not just SMTP but POP3, IMAP4, NNTP, etc. This should be released somtime this summer.
In the meantime before that is released I will update Opensmtp.net and fix what was stated above. Thanks again.