AspNet.StarterKits.Classifieds.BusinessLogicLayer.AdsDB.SendAdInEmail C# (CSharp) Метод

SendAdInEmail() публичный статический Метод

public static SendAdInEmail ( int adId, string senderName, string senderAddress, string recipientEmail, string subject, string message ) : bool
adId int
senderName string
senderAddress string
recipientEmail string
subject string
message string
Результат bool
		public static bool SendAdInEmail(int adId, string senderName, string senderAddress, string recipientEmail, string subject, string message)
		{
			bool sent = false;
			string from = String.Format("{0} <{1}>", senderName, senderAddress);
			try
			{
				MailMessage m = new MailMessage(from, recipientEmail);
				m.Subject = subject;
				m.Body = message;
				SmtpClient client = new SmtpClient();
				client.Send(m);
				sent = true;
			}
			catch
			{
				// Consider customizing the message for the EmailNotSentPanel in the ShowAds page.
				sent = false;
			}
			return sent;
		}