/// <summary> /// Send the email via the specified SMTP server /// </summary> /// <param name="smtpserver">The SMTP server to use</param> /// <returns>true if the email was sent</returns> public bool Send(SmtpServer smtpserver) { // smtpproxy=SmtpProxy.GetInstance(smtpserver); if (_rcpttoaddresses.Count == 0) { throw new MailException("Please include a RCPT TO address"); } if (_mailfrom == null) { throw new MailException("Please include a MAIL FROM address"); } return(smtpserver.Send(this, _rcpttoaddresses, _mailfrom)); }
/// <summary> /// Send out the email via the smtp server given. If /// the SMTP server throws an error, an SmtpException will /// be thrown. All other exceptions will be MailExceptions /// </summary> /// <param name="smtpserver">The outgoing SMTP server.</param> /// <returns>true if sent successfully. (note that this /// will not currently return false, but in the future /// a false value may be used)</returns> public bool Send(SmtpServer smtpserver) { //SmtpProxy smtpproxy=smtpserver.GetSmtpProxy(); if (_fromaddress == null) { throw new MailException(ARM.GetInstance().GetString("error_no_from")); } EmailAddress envelopefrom = _envelopefromaddress; if (envelopefrom == null) { envelopefrom = _fromaddress; } EmailAddressCollection allrecipients = new EmailAddressCollection(); allrecipients.AddCollection(_toaddresses); allrecipients.AddCollection(_ccaddresses); allrecipients.AddCollection(_bccaddresses); return(smtpserver.Send(this, allrecipients, envelopefrom)); }
/// <summary> /// Send out the email via the smtp server given. If /// the SMTP server throws an error, an SmtpException will /// be thrown. All other exceptions will be MailExceptions /// </summary> /// <param name="smtpserver">The outgoing SMTP server.</param> /// <returns>true if sent successfully. (note that this /// will not currently return false, but in the future /// a false value may be used)</returns> public bool Send(SmtpServer smtpserver) { //SmtpProxy smtpproxy=smtpserver.GetSmtpProxy(); if(_fromaddress == null) { throw new MailException(ARM.GetInstance().GetString("error_no_from")); } EmailAddress envelopefrom=_envelopefromaddress; if (envelopefrom==null) { envelopefrom=_fromaddress; } EmailAddressCollection allrecipients=new EmailAddressCollection(); allrecipients.AddCollection(_toaddresses); allrecipients.AddCollection(_ccaddresses); allrecipients.AddCollection(_bccaddresses); return smtpserver.Send(this, allrecipients, envelopefrom); }
/// <summary> /// Send the email via the specified SMTP server /// </summary> /// <param name="smtpserver">The SMTP server to use</param> /// <returns>true if the email was sent</returns> public bool Send(SmtpServer smtpserver) { // smtpproxy=SmtpProxy.GetInstance(smtpserver); if (_rcpttoaddresses.Count==0) { throw new MailException("Please include a RCPT TO address"); } if (_mailfrom==null) { throw new MailException("Please include a MAIL FROM address"); } return smtpserver.Send(this, _rcpttoaddresses, _mailfrom); }