Microsoft.SharePoint
using Microsoft.SharePoint; using System.Net.Mail;
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net.Mail;using Microsoft.SharePoint.Administration; namespace SendEmail{ class Program { static void Main(string[] args) { SPWebApplication webApp = SPWebApplication.Lookup(new Uri("https://serverName/")); MailMessage mail = new MailMessage(); mail.From = new MailAddress("[email protected]"); mail.To.Add("[email protected]"); mail.Subject = "Test"; mail.Body = "TEST"; // SmtpClient class sends the email by using the specified SMTP server SmtpClient smtp = new SmtpClient(webApp.OutboundMailServiceInstance.Server.Address); smtp.UseDefaultCredentials = true; smtp.Send(mail); } }}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using Microsoft.SharePoint.Administration;
namespace SendEmail
{
class Program
static void Main(string[] args)
SPWebApplication webApp = SPWebApplication.Lookup(new Uri("https://serverName/"));
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Test";
mail.Body = "TEST";
// SmtpClient class sends the email by using the specified SMTP server
SmtpClient smtp = new SmtpClient(webApp.OutboundMailServiceInstance.Server.Address);
smtp.UseDefaultCredentials = true;
smtp.Send(mail);
}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: