本文整理汇总了C#中SendGrid.SendGridMessage.AddBcc方法的典型用法代码示例。如果您正苦于以下问题:C# SendGridMessage.AddBcc方法的具体用法?C# SendGridMessage.AddBcc怎么用?C# SendGridMessage.AddBcc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendGrid.SendGridMessage
的用法示例。
在下文中一共展示了SendGridMessage.AddBcc方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: configSendGridasync
private async Task configSendGridasync(IdentityMessage message)
{
var myMessage = new SendGridMessage();
myMessage.AddTo(message.Destination);
myMessage.AddBcc("[email protected]");
myMessage.From = new MailAddress("[email protected]", "Account | Calgary School Buses");
myMessage.Subject = message.Subject;
myMessage.Text = message.Body;
myMessage.Html = message.Body;
var credentials = new NetworkCredential(ConfigurationManager.AppSettings["SendGridUsername"], ConfigurationManager.AppSettings["SendGridPassword"]);
// Create a Web transport for sending email.
var transportWeb = new Web(credentials);
// Send the email.
try
{
await transportWeb.DeliverAsync(myMessage);
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
}
}
示例2: SendAsync
public override async Task SendAsync(IdentityMessage message, GlobalValuesVM g)
{
string sendGridUserName = g.SendGridUserName;
string sendGridPassword = g.SendGridPassword;
string fromEmailAddress = g.FromEmailAddress;
string bccEmailAddress = g.BccEmailAddress;
string subject = message.Subject;
string body = message.Body;
var myMessage = new SendGridMessage();
myMessage.AddTo(message.Destination);
myMessage.From = new System.Net.Mail.MailAddress(fromEmailAddress);
myMessage.AddBcc(bccEmailAddress);
myMessage.Subject = subject;
myMessage.Text = body;
myMessage.Html = body;
var credentials = new NetworkCredential(
sendGridUserName,
sendGridPassword);
//Create the transport
var transportWeb = new Web(credentials);
//Send Email
if (transportWeb != null)
{
try
{
//sendGridUserName
if (sendGridUserName.ToLower() == string.Format("Enter Your sendgrid.com User Id").ToLower())
throw new Exception("You have not entered your Send Grid USER NAME");
//sendGridPassword
if (sendGridPassword.ToLower() == string.Format("Enter Your sendgrid.com Password").ToLower())
throw new Exception("You have not entered your Send Grid PASSWORD");
await transportWeb.DeliverAsync(myMessage);
}
catch (Exception ex)
{
throw new HttpException("EMAIL Exception. Unable to resolve the remote server. Please try again later. Error: " + ex.Message);
}
}
else
{
System.Diagnostics.Trace.TraceError("Failed to create a Web Transport");
await Task.FromResult(0);
throw new HttpException("EMAIL Exception. Failed to create a Web Transport");
}
}
示例3: SendGridEmail
/// <summary>
/// Sends out an email from the application. Returns true if successful.
/// </summary>
public static bool SendGridEmail(string from, List<string> to, List<string> cc, List<string> bcc, string subj, string body, string smtpUser, string smtpUserPwd)
{
try
{
//******************** CONSTRUCT EMAIL ********************************************
// Create the email object first, then add the properties.
var myMessage = new SendGridMessage();
// Add message properties.
myMessage.From = new MailAddress(from);
myMessage.AddTo(to);
if (cc != null)
{
foreach (string cc1 in cc)
myMessage.AddCc(cc1);
}
if (bcc != null)
{
foreach (string bcc1 in bcc)
myMessage.AddBcc(bcc1);
}
myMessage.Subject = subj;
//myMessage.Html = "<p>" + body + "</p>";
myMessage.Text = body;
//*********************************************************************************
//********************* SEND EMAIL ************************************************
var credentials = new NetworkCredential(smtpUser, smtpUserPwd);
// Create an Web transport for sending email.
var transportWeb = new Web(credentials);
// Send the email.
transportWeb.Deliver(myMessage);
return true;
}
catch (Exception ex)
{
if (ex.InnerException != null)
db_Ref.InsertT_OE_SYS_LOG("EMAIL ERR", ex.InnerException.ToString());
else if (ex.Message != null)
db_Ref.InsertT_OE_SYS_LOG("EMAIL ERR", ex.Message.ToString());
else
db_Ref.InsertT_OE_SYS_LOG("EMAIL ERR", "Unknown error");
return false;
}
}
示例4: TopluMailGonder
public static void TopluMailGonder(List<string> Alicilar,string Konu,string Html)
{
SendGridMessage mesaj = new SendGridMessage();
var bulutDersMail=System.Configuration.ConfigurationManager.AppSettings["BulutDersMail"];
mesaj.AddTo(string.Format("Undisclosed Recipients <{0}>",bulutDersMail));
foreach (var alici in Alicilar)
{
mesaj.AddBcc(alici);
}
mesaj.From = new MailAddress(bulutDersMail, "BulutDers");
mesaj.Subject = Konu;
mesaj.Html=Html;
var transportWeb = new Web(System.Configuration.ConfigurationManager.AppSettings["SendGridApiKey"]);
transportWeb.DeliverAsync(mesaj);
}
示例5: SendMail
public static async void SendMail(string emailaddress, string subject, string mytemplate)
{
Console.Write("emailaddress = " + emailaddress);
Console.Write("subject = " + subject);
Console.Write("mytemplate = " + mytemplate);
// Create the email object first, then add the properties.
var myMessage = new SendGridMessage();
// Add the message properties.
myMessage.From = new MailAddress("[email protected]", "VirtualGarageSales");
// Add multiple addresses to the To field.
List<String> recipients = new List<String>
{
emailaddress
};
myMessage.AddTo(recipients);
myMessage.AddBcc("[email protected]");
myMessage.Subject = subject;
//Add the HTML and Text bodies
string template = mytemplate;
myMessage.Html = template;
myMessage.Text = "Hello World plain text!";
// Create network credentials to access your SendGrid account.
var username = "[email protected]";
var pswd = "Lappies12";
var credentials = new NetworkCredential(username, pswd);
// Create an Web transport for sending email, using credentials...
var transportWeb = new Web(credentials);
// Send the email.
try
{
await transportWeb.DeliverAsync(myMessage);
Console.WriteLine("Sent!");
}
catch (Exception ex)
{
Console.WriteLine("ERROR = " + ex.Message);
}
}
示例6: SendWelcomeEmail
public void SendWelcomeEmail(Usuario usuario)
{
// Create the email object first, then add the properties.
var myMessage = new SendGridMessage();
// Add the message properties.
myMessage.From = new MailAddress("[email protected]", "Projeto Joule");
// Add multiple addresses to the To field.
List<string> recipients = new List<string>
{
usuario.Email
};
myMessage.AddTo(recipients);
myMessage.AddBcc(@"cadas[email protected]");
myMessage.Subject = "Obrigado!";
//Add the HTML and Text bodies
myMessage.Html = string.Format(@"<img src='http://projetojoule.com/wp-content/uploads/LogoNome.png' />
<p>Olá {0},</p>
<p>Muito obrigado por ter efetuado sua inscrição para participar nos programs do Projeto Joule.
Este e-mail é para confirmar que recebemos sua inscrição e que estamos ansiosos para começar a trabalhar juntos.
Em breve entraremos em contato!</p>
<p>Por enquanto, não deixe de curtir nossa página e nos seguir nas redes sociais:</p>
<p>Linkedin: <a href='https://www.linkedin.com/company/projeto-joule'>https://www.linkedin.com/company/projeto-joule</a> <br />
Facebook: <a href='https://www.facebook.com/projetojoule'>https://www.facebook.com/projetojoule</a> <br />
Twitter: <a href='https://twitter.com/projetojoule'>https://twitter.com/projetojoule</a> <br />
Blog: <a href='http://www.projetojoule.com/blog'>http://www.projetojoule.com/blog</a></p>
<p>Um abraço,</p>
<p>Equipe Projeto Joule<p>", usuario.FirstName);
//myMessage.Text = "Seja bem-vindo!";
this.SendEmail(myMessage);
this.SendAdminEmail(usuario);
}