/// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="sender">Senders email address.</param>
        /// <param name="recipient">Recipients email address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <param name="date">Message date.</param>
        /// <param name="delayedDeliveryNotifySent">Specifies if delayed delivery notify has been sent.</param>
        /// <param name="hostEndPoint">Host end point where message must be sent. Value null means DNS is used to get message target host.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>sender</b> or <b>recipient</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public RelayMessageInfo(string envelopeID, string sender, string recipient, string originalRecipient, SMTP_DSN_Notify notify, SMTP_DSN_Ret ret, DateTime date, bool delayedDeliveryNotifySent, HostEndPoint hostEndPoint)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (recipient == "")
            {
                throw new ArgumentException("Argument 'recipient' value must be specified.");
            }

            m_EnvelopeID        = envelopeID;
            m_Sender            = sender;
            m_Recipient         = recipient;
            m_OriginalRecipient = originalRecipient;
            m_DSN_Notify        = notify;
            m_DSN_Ret           = ret;
            m_Date = date;
            m_DelayedDeliveryNotifySent = delayedDeliveryNotifySent;
            m_pHostEndPoint             = hostEndPoint;
        }
Пример #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailbox">Mailbox value.</param>
        /// <param name="notify">DSN NOTIFY parameter value.</param>
        /// <param name="orcpt">DSN ORCPT parameter value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>mailbox</b> is null reference.</exception>
        public SMTP_RcptTo(string mailbox,SMTP_DSN_Notify notify,string orcpt)
        {
            if(mailbox == null){
                throw new ArgumentNullException("mailbox");
            }

            m_Mailbox = mailbox;
            m_Notify  = notify;
            m_ORCPT   = orcpt;
        }
Пример #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="mailbox">Mailbox value.</param>
        /// <param name="notify">DSN NOTIFY parameter value.</param>
        /// <param name="orcpt">DSN ORCPT parameter value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>mailbox</b> is null reference.</exception>
        public SMTP_RcptTo(string mailbox, SMTP_DSN_Notify notify, string orcpt)
        {
            if (mailbox == null)
            {
                throw new ArgumentNullException("mailbox");
            }

            m_Mailbox = mailbox;
            m_Notify  = notify;
            m_ORCPT   = orcpt;
        }
Пример #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="queue">Item owner queue.</param>
 /// <param name="from">Sender address.</param>
 /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
 /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
 /// <param name="to">Target recipient address.</param>
 /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
 /// <param name="notify">DSN notify condition.</param>
 /// <param name="messageID">Message ID.</param>
 /// <param name="message">Raw mime message. Message reading starts from current position.</param>
 /// <param name="tag">User data.</param>
 internal Relay_QueueItem(Relay_Queue queue,string from,string envelopeID,SMTP_DSN_Ret ret,string to,string originalRecipient,SMTP_DSN_Notify notify,string messageID,Stream message,object tag)
 {
     m_pQueue            = queue;
     m_From              = from;
     m_EnvelopeID        = envelopeID;
     m_DSN_Ret           = ret;
     m_To                = to;
     m_OriginalRecipient = originalRecipient;
     m_DSN_Notify        = notify;
     m_MessageID         = messageID;
     m_pMessageStream    = message;
     m_pTag              = tag;
 }
Пример #5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="queue">Item owner queue.</param>
 /// <param name="from">Sender address.</param>
 /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
 /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
 /// <param name="to">Target recipient address.</param>
 /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
 /// <param name="notify">DSN notify condition.</param>
 /// <param name="messageID">Message ID.</param>
 /// <param name="message">Raw mime message. Message reading starts from current position.</param>
 /// <param name="tag">User data.</param>
 internal Relay_QueueItem(Relay_Queue queue, string from, string envelopeID, SMTP_DSN_Ret ret, string to, string originalRecipient, SMTP_DSN_Notify notify, string messageID, Stream message, object tag)
 {
     m_pQueue            = queue;
     m_From              = from;
     m_EnvelopeID        = envelopeID;
     m_DSN_Ret           = ret;
     m_To                = to;
     m_OriginalRecipient = originalRecipient;
     m_DSN_Notify        = notify;
     m_MessageID         = messageID;
     m_pMessageStream    = message;
     m_pTag              = tag;
 }
Пример #6
0
        /// <summary>
        /// Queues message for relay.
        /// </summary>
        /// <param name="from">Sender address.</param>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <param name="to">Target recipient address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="messageID">Message ID.</param>
        /// <param name="message">Raw mime message. Message reading starts from current position.</param>
        /// <param name="tag">User data.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>to</b>,<b>to</b>,<b>messageID</b> or <b>message</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public void QueueMessage(string from,string envelopeID,SMTP_DSN_Ret ret,string to,string originalRecipient,SMTP_DSN_Notify notify,string messageID,Stream message,object tag)
        {
            if(messageID == null){
                throw new ArgumentNullException("messageID");
            }
            if(messageID == ""){
                throw new ArgumentException("Argument 'messageID' value must be specified.");
            }
            if(message == null){
                throw new ArgumentNullException("message");
            }

            lock(m_pQueue){
                m_pQueue.Enqueue(new Relay_QueueItem(this,from,envelopeID,ret,to,originalRecipient,notify,messageID,message,tag));
            }
        }
Пример #7
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="sender">Senders email address.</param>
        /// <param name="recipient">Recipients email address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <param name="date">Message date.</param>
        /// <param name="delayedDeliveryNotifySent">Specifies if delayed delivery notify has been sent.</param>
        /// <param name="hostEndPoint">Host end point where message must be sent. Value null means DNS is used to get message target host.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>sender</b> or <b>recipient</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public RelayMessageInfo(string envelopeID,string sender,string recipient,string originalRecipient,SMTP_DSN_Notify notify,SMTP_DSN_Ret ret,DateTime date,bool delayedDeliveryNotifySent,HostEndPoint hostEndPoint)
        {
            if(sender == null){
                throw new ArgumentNullException("sender");
            }
            if(recipient == null){
                throw new ArgumentNullException("recipient");
            }
            if(recipient == ""){
                throw new ArgumentException("Argument 'recipient' value must be specified.");
            }

            m_EnvelopeID                = envelopeID;
            m_Sender                    = sender;
            m_Recipient                 = recipient;
            m_OriginalRecipient         = originalRecipient;
            m_DSN_Notify                = notify;
            m_DSN_Ret                   = ret;
            m_Date                      = date;
            m_DelayedDeliveryNotifySent = delayedDeliveryNotifySent;
            m_pHostEndPoint             = hostEndPoint;
        }
Пример #8
0
        /// <summary>
        /// Sends RCPT TO: command to SMTP server.
        /// </summary>
        /// <param name="to">Recipient email address.</param>
        /// <param name="notify">Delivery satus notification(DSN) NOTIFY value. For more info see RFC 3461.</param>
        /// <param name="orcpt">Delivery satus notification(DSN) ORCPT value. Value null means not specified. For more info see RFC 3461.</param>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        /// <exception cref="InvalidOperationException">Is raised when SMTP client is not connected.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        /// <exception cref="SMTP_ClientException">Is raised when SMTP server returns error.</exception>
        /// <remarks>Before using <b>notify</b> or <b>orcpt</b> arguments, check that remote server supports(SMTP_Client.EsmtpFeatures) SMTP DSN extention.</remarks>
        public void RcptTo(string to,SMTP_DSN_Notify notify,string orcpt)
        {
            if(this.IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(!this.IsConnected){
                throw new InvalidOperationException("You must connect first.");
            }
            
            ManualResetEvent wait = new ManualResetEvent(false);
            using(RcptToAsyncOP op = new RcptToAsyncOP(to,notify,orcpt)){
                op.CompletedAsync += delegate(object s1,EventArgs<RcptToAsyncOP> e1){
                    wait.Set();
                };
                if(!this.RcptToAsync(op)){
                    wait.Set();
                }
                wait.WaitOne();
                wait.Close();

                if(op.Error != null){
                    throw op.Error;
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Sends RCPT TO: command to SMTP server.
        /// </summary>
        /// <param name="to">Recipient email address.</param>
        /// <param name="notify">Delivery satus notification(DSN) NOTIFY value. For more info see RFC 3461.</param>
        /// <param name="orcpt">Delivery satus notification(DSN) ORCPT value. Value null means not specified. For more info see RFC 3461.</param>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        /// <exception cref="InvalidOperationException">Is raised when SMTP client is not connected.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        /// <exception cref="SMTP_ClientException">Is raised when SMTP server returns error.</exception>
        /// <remarks>Before using <b>notify</b> or <b>orcpt</b> arguments, check that remote server supports SMTP DSN extention.</remarks>
        public void RcptTo(string to,SMTP_DSN_Notify notify,string orcpt)
        {
            if(this.IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(!this.IsConnected){
                throw new InvalidOperationException("You must connect first.");
            }
            if(!SMTP_Utils.IsValidAddress(to)){
                throw new ArgumentException("Argument from has invalid value.");
            }

            /* RFC 2821 4.1.1.2 RCPT.
                Syntax:
                    "RCPT TO:" ("<Postmaster@" domain ">" / "<Postmaster>" / Forward-Path) [SP Rcpt-parameters] CRLF

                Examples:
             		RCPT TO:<*****@*****.**>

                RFC 3461 adds NOTIFY and ORCPT parameters.
            */

            StringBuilder cmd = new StringBuilder();
            cmd.Append("RCPT TO:<" + to + ">");
            if(notify == SMTP_DSN_Notify.NotSpecified){
            }
            else if(notify == SMTP_DSN_Notify.Never){
                cmd.Append(" NOTIFY=NEVER");
            }
            else{
                bool first = true;
                if((notify & SMTP_DSN_Notify.Delay) != 0){
                    cmd.Append(" NOTIFY=DELAY");
                    first = false;
                }
                if((notify & SMTP_DSN_Notify.Failure) != 0){
                    if(first){
                        cmd.Append(" NOTIFY=FAILURE");
                    }
                    else{
                        cmd.Append(",FAILURE");
                    }
                    first = false;
                }
                if((notify & SMTP_DSN_Notify.Success) != 0){
                    if(first){
                        cmd.Append(" NOTIFY=SUCCESS");
                    }
                    else{
                        cmd.Append(",SUCCESS");
                    }
                    first = false;
                }
            }
            if(!string.IsNullOrEmpty(orcpt)){
                cmd.Append(" ORCPT=" + orcpt);
            }

            WriteLine(cmd.ToString());

            // Read first line of reply, check if it's ok.
            string line = ReadLine();
            if(!line.StartsWith("250")){
                throw new SMTP_ClientException(line);
            }

            if(!m_pRecipients.Contains(to)){
                m_pRecipients.Add(to);
            }
        }
        /// <summary>
        /// Queues message for relay.
        /// </summary>
        /// <param name="targetServer">Gets server where to send message. Value null means target server will be resolved by relay server.</param>
        /// <param name="from">Sender address.</param>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <param name="to">Target recipient address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="messageID">Message ID.</param>
        /// <param name="message">Raw mime message. Message reading starts from current position.</param>
        /// <param name="tag">User data.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>to</b>,<b>to</b>,<b>messageID</b> or <b>message</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public void QueueMessage(Relay_SmartHost targetServer, string from, string envelopeID, SMTP_DSN_Ret ret, string to, string originalRecipient, SMTP_DSN_Notify notify, string messageID, Stream message, object tag)
        {
            if (messageID == null)
            {
                throw new ArgumentNullException("messageID");
            }
            if (messageID == "")
            {
                throw new ArgumentException("Argument 'messageID' value must be specified.");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            lock (m_pQueue){
                m_pQueue.Enqueue(new Relay_QueueItem(this, targetServer, from, envelopeID, ret, to, originalRecipient, notify, messageID, message, tag));
            }
        }
 /// <summary>
 /// Queues message for relay.
 /// </summary>
 /// <param name="from">Sender address.</param>
 /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
 /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
 /// <param name="to">Target recipient address.</param>
 /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
 /// <param name="notify">DSN notify condition.</param>
 /// <param name="messageID">Message ID.</param>
 /// <param name="message">Raw mime message. Message reading starts from current position.</param>
 /// <param name="tag">User data.</param>
 /// <exception cref="ArgumentNullException">Is raised when <b>to</b>,<b>to</b>,<b>messageID</b> or <b>message</b> is null.</exception>
 /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
 public void QueueMessage(string from, string envelopeID, SMTP_DSN_Ret ret, string to, string originalRecipient, SMTP_DSN_Notify notify, string messageID, Stream message, object tag)
 {
     QueueMessage(null, from, envelopeID, ret, to, originalRecipient, notify, messageID, message, tag);
 }
Пример #12
0
        private void StoreRelayMessage(string queueName, string id, string envelopeID, DateTime date, Stream message, HostEndPoint targetHost, string sender, string to, string originalRecipient, SMTP_DSN_Notify notify, SMTP_DSN_Ret ret)
        {
            if (queueName == null)
            {
                throw new ArgumentNullException("queueName");
            }
            if (queueName == "")
            {
                throw new ArgumentException("Argumnet 'queueName' value must be specified.");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (id == "")
            {
                throw new ArgumentException("Argument 'id' value must be specified.");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            if (to == null)
            {
                throw new ArgumentNullException("to");
            }
            if (to == "")
            {
                throw new ArgumentException("Argument 'to' value must be specified.");
            }
            string text = this.m_pVirtualServer.MailStorePath + queueName;

            if (!Directory.Exists(text))
            {
                Directory.CreateDirectory(text);
            }
            using (FileStream fileStream = File.Create(PathHelper.PathFix(text + "\\" + id + ".eml")))
            {
                SCore.StreamCopy(message, fileStream);
                RelayMessageInfo relayMessageInfo = new RelayMessageInfo(envelopeID, sender, to, originalRecipient, notify, ret, date, false, targetHost);
                File.WriteAllBytes(PathHelper.PathFix(text + "\\" + id + ".info"), relayMessageInfo.ToByte());
            }
        }
Пример #13
0
        /// <summary>
        /// Stores message for relay.
        /// </summary>
        /// <param name="queueName">Queue name where to store message.</param>
        /// <param name="id">Message ID. Guid value is suggested.</param>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="date">Message date.</param>
        /// <param name="message">Message to store. Message will be readed from current position of stream.</param>
        /// <param name="targetHost">Target host or IP where to send message. This value can be null, then DNS MX o A record is used to deliver message.</param>
        /// <param name="sender">Sender address to report to target server.</param>
        /// <param name="to">Message recipient address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>queueName</b>,<b>id</b>,<b>message</b> or <b>to</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the argumnets has invalid value.</exception>
        private void StoreRelayMessage(string queueName, string id, string envelopeID, DateTime date, Stream message, HostEndPoint targetHost, string sender, string to, string originalRecipient, SMTP_DSN_Notify notify, SMTP_DSN_Ret ret)
        {
            if (queueName == null)
            {
                throw new ArgumentNullException("queueName");
            }
            if (queueName == "")
            {
                throw new ArgumentException("Argumnet 'queueName' value must be specified.");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (id == "")
            {
                throw new ArgumentException("Argument 'id' value must be specified.");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            if (to == null)
            {
                throw new ArgumentNullException("to");
            }
            if (to == "")
            {
                throw new ArgumentException("Argument 'to' value must be specified.");
            }

            string path = m_pVirtualServer.MailStorePath + queueName;

            // Check if Directory exists, if not Create
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            // Create relay message.
            using (FileStream fs = File.Create(API_Utlis.PathFix(path + "\\" + id + ".eml"))){
                SCore.StreamCopy(message, fs);

                // Create message info file for the specified relay message.
                RelayMessageInfo messageInfo = new RelayMessageInfo(
                    envelopeID,
                    sender,
                    to,
                    originalRecipient,
                    notify,
                    ret,
                    date,
                    false,
                    targetHost
                    );
                File.WriteAllBytes(API_Utlis.PathFix(path + "\\" + id + ".info"), messageInfo.ToByte());
            }
        }
Пример #14
0
 /// <summary>
 /// Stores message for relay.
 /// </summary>
 /// <param name="id">Message ID. Guid value is suggested.</param>
 /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
 /// <param name="message">Message to store. Message will be readed from current position of stream.</param>
 /// <param name="targetHost">Target host or IP where to send message. This value can be null, then DNS MX o A record is used to deliver message.</param>
 /// <param name="sender">Sender address to report to target server.</param>
 /// <param name="to">Message recipient address.</param>
 /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
 /// <param name="notify">DSN notify condition.</param>
 /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
 /// <exception cref="ArgumentNullException">Is raised when <b>id</b>,<b>message</b> or <b>to</b> is null.</exception>
 /// <exception cref="ArgumentException">Is raised when any of the argumnets has invalid value.</exception>
 public void StoreRelayMessage(string id,String envelopeID,Stream message,HostEndPoint targetHost,string sender,string to,string originalRecipient,SMTP_DSN_Notify notify,SMTP_DSN_Ret ret)
 {
     StoreRelayMessage("Relay",id,envelopeID,DateTime.Now,message,targetHost,sender,to,originalRecipient,notify,ret);
 }
Пример #15
0
        /// <summary>
        /// Stores message for relay.
        /// </summary>
        /// <param name="queueName">Queue name where to store message.</param>
        /// <param name="id">Message ID. Guid value is suggested.</param>
        /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
        /// <param name="date">Message date.</param>
        /// <param name="message">Message to store. Message will be readed from current position of stream.</param>
        /// <param name="targetHost">Target host or IP where to send message. This value can be null, then DNS MX o A record is used to deliver message.</param>
        /// <param name="sender">Sender address to report to target server.</param>
        /// <param name="to">Message recipient address.</param>
        /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
        /// <param name="notify">DSN notify condition.</param>
        /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>queueName</b>,<b>id</b>,<b>message</b> or <b>to</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the argumnets has invalid value.</exception>
        private void StoreRelayMessage(string queueName,string id,string envelopeID,DateTime date,Stream message,HostEndPoint targetHost,string sender,string to,string originalRecipient,SMTP_DSN_Notify notify,SMTP_DSN_Ret ret)
        {
            if(queueName == null){
                throw new ArgumentNullException("queueName");
            }
            if(queueName == ""){
                throw new ArgumentException("Argumnet 'queueName' value must be specified.");
            }
            if(id == null){
                throw new ArgumentNullException("id");
            }
            if(id == ""){
                throw new ArgumentException("Argument 'id' value must be specified.");
            }
            if(message == null){
                throw new ArgumentNullException("message");
            }
            if(to == null){
                throw new ArgumentNullException("to");
            }
            if(to == ""){
                throw new ArgumentException("Argument 'to' value must be specified.");
            }
					
			string path = m_pVirtualServer.MailStorePath + queueName;

			// Check if Directory exists, if not Create
			if(!Directory.Exists(path)){
				Directory.CreateDirectory(path);
			}

			// Create relay message.
			using(FileStream fs = File.Create(API_Utlis.PathFix(path + "\\" + id + ".eml"))){
                SCore.StreamCopy(message,fs);
                               
                // Create message info file for the specified relay message.
                RelayMessageInfo messageInfo = new RelayMessageInfo(
                    envelopeID,
                    sender,
                    to,
                    originalRecipient,
                    notify,
                    ret,
                    date,
                    false,
                    targetHost
                );
                File.WriteAllBytes(API_Utlis.PathFix(path + "\\" + id + ".info"),messageInfo.ToByte());
			}
        }
Пример #16
0
            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="to">Recipient email address.</param>
            /// <param name="notify">Delivery satus notification(DSN) NOTIFY value. For more info see RFC 3461.</param>
            /// <param name="orcpt">Delivery satus notification(DSN) ORCPT value. Value null means not specified. For more info see RFC 3461.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>to</b> is null reference.</exception>
            /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
            public RcptToAsyncOP(string to,SMTP_DSN_Notify notify,string orcpt)
            {
                if(to == null){
                    throw new ArgumentNullException("to");
                }
                if(to == string.Empty){
                    throw new ArgumentException("Argument 'to' value must be specified.","to");
                }

                m_To        = to;
                m_DsnNotify = notify;
                m_ORcpt     = orcpt;
            }
Пример #17
0
        public IAsyncResult BeginRcptTo(string to,SMTP_DSN_Notify notify,string orcpt,AsyncCallback callback,object state)
        {
            if(this.IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(!this.IsConnected){
				throw new InvalidOperationException("You must connect first.");
			}

            RcptToDelegate asyncMethod = new RcptToDelegate(this.RcptTo);
            AsyncResultState asyncState = new AsyncResultState(this,asyncMethod,callback,state);
            asyncState.SetAsyncResult(asyncMethod.BeginInvoke(to,notify,orcpt,new AsyncCallback(asyncState.CompletedCallback),null));

            return asyncState;
        }
Пример #18
0
 /// <summary>
 /// Stores message for relay.
 /// </summary>
 /// <param name="id">Message ID. Guid value is suggested.</param>
 /// <param name="envelopeID">Envelope ID_(MAIL FROM: ENVID).</param>
 /// <param name="message">Message to store. Message will be readed from current position of stream.</param>
 /// <param name="targetHost">Target host or IP where to send message. This value can be null, then DNS MX o A record is used to deliver message.</param>
 /// <param name="sender">Sender address to report to target server.</param>
 /// <param name="to">Message recipient address.</param>
 /// <param name="originalRecipient">Original recipient(RCPT TO: ORCPT).</param>
 /// <param name="notify">DSN notify condition.</param>
 /// <param name="ret">Specifies what parts of message are returned in DSN report.</param>
 /// <exception cref="ArgumentNullException">Is raised when <b>id</b>,<b>message</b> or <b>to</b> is null.</exception>
 /// <exception cref="ArgumentException">Is raised when any of the argumnets has invalid value.</exception>
 public void StoreRelayMessage(string id, String envelopeID, Stream message, HostEndPoint targetHost, string sender, string to, string originalRecipient, SMTP_DSN_Notify notify, SMTP_DSN_Ret ret)
 {
     StoreRelayMessage("Relay", id, envelopeID, DateTime.Now, message, targetHost, sender, to, originalRecipient, notify, ret);
 }