/// <summary> /// Validates syntax and existence of the given address. /// </summary> /// <param name="address">The address to be validated.</param> /// <param name="dnsServerHost">Name Server to be used for MX records search.</param> /// <returns>True if the address is valid, otherwise false.</returns> public static bool Validate(Address address, string dnsServerHost) { ServerCollection servers = new ServerCollection(); servers.Add(dnsServerHost, 53); return(Validate(address.Email, servers)); }
/// <summary> /// Sends the message using the specified host as dns server on the specified port. /// </summary> /// <param name="host">The host to be used.</param> /// <param name="port">The port to be used.</param> /// <example> /// <code> /// C# /// /// SmtpMessage message = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// /// VB.NET /// /// Dim message As New SmtpMessage /// message.Subject = "Test" /// message.From = New Address("*****@*****.**","John Doe") /// message.To.Add("*****@*****.**","Mike Johns") /// message.BodyText.Text = "Hello this is a test!" /// /// message.DirectSend("ns1.dnsserver.com",53) /// /// JScript.NET /// /// var message:SmtpMessage = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// </code> /// </example> public string DirectSend(string dnsHost, int dnsPort) { ServerCollection servers = new ServerCollection(); servers.Add(dnsHost, dnsPort); return(DirectSend(servers)); }
private void _bSendMessage_Click(object sender, EventArgs e) { this.AddLogEntry("Creating message."); // We create the message object ActiveUp.Net.Mail.Message message = new ActiveUp.Net.Mail.Message(); // We assign the sender email message.From.Email = this._tbFromEmail.Text; // We assign the recipient email message.To.Add(this._tbToEmail.Text); // We assign the subject message.Subject = this._tbSubject.Text; // We assign the body text message.BodyText.Text = this._tbBodyText.Text; ServerCollection smtpServers = new ServerCollection(); smtpServers.Add(this._tbMainSmtpServer.Text); smtpServers.Add(this._tbBackupSmtpServer.Text); // We send the email using the specified SMTP server this.AddLogEntry("Sending message."); try { message.Send(smtpServers); this.AddLogEntry("Message sent successfully."); } catch (SmtpException ex) { this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } }
/// <summary> /// Allows the developer to add a collection of Server objects in another one. /// </summary> /// <param name="first">The first collection.</param> /// <param name="second">The second collection.</param> /// <returns>The concacened collection.</returns> public static ServerCollection operator +(ServerCollection first, ServerCollection second) { ServerCollection newServers = first; foreach (Server server in second) { newServers.Add(server); } return(newServers); }
public void Enviar() { ServerCollection servers = new ServerCollection(); Server Nlayer = new Server(); Message message = new Message(); MimeBody mimeBody = new MimeBody(BodyFormat.Html); AddressCollection destinos = new AddressCollection(); Nlayer.Host = "mail.softwareNlayer.com"; Nlayer.Password = "******"; Nlayer.Port = 25; Nlayer.Username = "******"; servers.Add(Nlayer); if (_destinos != null) { foreach (string destino in _destinos) { destinos.Add(new Address(destino)); } } if (_adjuntos != null) { foreach (string adjunto in _adjuntos) { message.Attachments.Add(adjunto, false); } } mimeBody.Text = _mensaje; message.BodyHtml = mimeBody; message.Date = DateTime.Now; message.From = new Address("*****@*****.**"); message.Organization = "Nlayer Software"; message.Priority = MessagePriority.Normal; message.To = destinos; message.Subject = _asunto; AsyncCallback beginCallback = IniciaEnvio; SmtpClient.BeginSend(message, servers, beginCallback); }
/// <summary> /// Sends the message using the specified host as dns server on the specified port. /// </summary> /// <param name="host">The host to be used.</param> /// <param name="port">The port to be used.</param> /// <example> /// <code> /// C# /// /// SmtpMessage message = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// /// VB.NET /// /// Dim message As New SmtpMessage /// message.Subject = "Test" /// message.From = New Address("*****@*****.**","John Doe") /// message.To.Add("*****@*****.**","Mike Johns") /// message.BodyText.Text = "Hello this is a test!" /// /// message.DirectSend("ns1.dnsserver.com",53) /// /// JScript.NET /// /// var message:SmtpMessage = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// </code> /// </example> public string DirectSend(string dnsHost, int dnsPort) { ActiveUp.Net.Mail.ServerCollection servers = new ActiveUp.Net.Mail.ServerCollection(); servers.Add(dnsHost, dnsPort); return DirectSend(servers); }
/// <summary> /// Sends all messages using the specified host and port as the dns server. /// </summary> /// <param name="messages">The message collection to be sent.</param> /// <param name="dnsHost">Address of the server to be used.</param> /// <param name="dnsPort">Port to be used.</param> /// <returns>Amount of messages successfully sent.</returns> /// <example> /// <code> /// C# /// /// Message message = new Message(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// Message message1 = new Message(); /// message1.Subject = "Hey David!"; /// message1.From = New Address("*****@*****.**","John Doe"); /// message1.To.Add("*****@*****.**","David Clark"); /// message1.BodyText.Text = "How you doing ?"; /// /// MessageCollection messages = new MessageCollection(); /// messages.Add(message); /// messages.Add(message1); /// /// SmtpClient.DirectSend(messages,"ns1.dnsserver.com",53); /// /// VB.NET /// /// Dim message As New Message /// message.Subject = "Test" /// message.From = New Address("*****@*****.**","John Doe") /// message.To.Add("*****@*****.**","Mike Johns") /// message.BodyText.Text = "Hello this is a test!" /// /// Dim message1 As New Message /// message1.Subject = "Hey David!" /// message1.From = New Address("*****@*****.**","John Doe") /// message1.To.Add("*****@*****.**","David Clark") /// message1.BodyText.Text = "How you doing ?" /// /// Dim messages As New MessageCollection /// messages.Add(message) /// messages.Add(message1) /// /// SmtpClient.DirectSend(messages,"ns1.dnsserver.com",53) /// /// JScript.NET /// /// var message:Message = new Message(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// var message1:Message = new Message(); /// message1.Subject = "Hey David!"; /// message1.From = New Address("*****@*****.**","John Doe"); /// message1.To.Add("*****@*****.**","David Clark"); /// message1.BodyText.Text = "How you doing ?"; /// /// var messages:MessageCollection = new MessageCollection(); /// messages.Add(message); /// messages.Add(message1); /// /// SmtpClient.DirectSend(messages,"ns1.dnsserver.com",53); /// </code> /// </example> public static int DirectSendCollection(MessageCollection messages, string dnsHost, int dnsPort) { ActiveUp.Net.Mail.ServerCollection servers = new ActiveUp.Net.Mail.ServerCollection(); servers.Add(dnsHost, dnsPort); return DirectSendCollection(messages, servers); }
/// <summary> /// Validates syntax and existence of the given address. /// </summary> /// <param name="address">The address to be validated.</param> /// <param name="dnsServerHost">Name Server to be used for MX records search.</param> /// <returns>True if the address is valid, otherwise false.</returns> public static bool Validate(Address address, string dnsServerHost) { ActiveUp.Net.Mail.ServerCollection servers = new ActiveUp.Net.Mail.ServerCollection(); servers.Add(dnsServerHost, 53); return ActiveUp.Net.Mail.SmtpValidator.Validate(address.Email, servers); }
/// <summary> /// Sends the message using the specified host as dns server on the specified port. /// </summary> /// <param name="host">The host to be used.</param> /// <param name="port">The port to be used.</param> /// <example> /// <code> /// C# /// /// SmtpMessage message = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// /// VB.NET /// /// Dim message As New SmtpMessage /// message.Subject = "Test" /// message.From = New Address("*****@*****.**","John Doe") /// message.To.Add("*****@*****.**","Mike Johns") /// message.BodyText.Text = "Hello this is a test!" /// /// message.DirectSend("ns1.dnsserver.com",53) /// /// JScript.NET /// /// var message:SmtpMessage = new SmtpMessage(); /// message.Subject = "Test"; /// message.From = new Address("*****@*****.**","John Doe"); /// message.To.Add("*****@*****.**","Mike Johns"); /// message.BodyText.Text = "Hello this is a test!"; /// /// message.DirectSend("ns1.dnsserver.com",53); /// </code> /// </example> public string DirectSend(string dnsHost, int dnsPort) { ActiveUp.Net.Mail.ServerCollection servers = new ActiveUp.Net.Mail.ServerCollection(); servers.Add(dnsHost, dnsPort); return(DirectSend(servers)); }
/// <summary> /// Validates syntax and existence of the given address. /// </summary> /// <param name="address">The address to be validated.</param> /// <param name="dnsServerHost">Name Server to be used for MX records search.</param> /// <returns>True if the address is valid, otherwise false.</returns> public static bool Validate(Address address, string dnsServerHost) { ActiveUp.Net.Mail.ServerCollection servers = new ActiveUp.Net.Mail.ServerCollection(); servers.Add(dnsServerHost, 53); return(ActiveUp.Net.Mail.SmtpValidator.Validate(address.Email, servers)); }