我已将邮件地址更改为我的地址,主题以及所有详细信息都将出现,但仍然出错 \
它在我的代码中称为:
private bool SendEmailOnLeadCreation(
Users agentuser,
Users buyeruser,
ProjectUnitLeads projectUnitLeads)
{
string appSetting = ConfigurationManager.AppSettings["WebsiteURL"];
CommonEmailSettingsModel emailSettings = this._emailManager.GetEmailSettings();
EmailManager emailManager = new EmailManager(emailSettings);
List<KeyValuePair<string, string>> mailContent = this._emailManager.GetMailContent("LeadCreation");
List<string> stringList = new List<string>();
stringList.Add(buyeruser.UserName);
string str1 = mailContent.Where<KeyValuePair<string, string>>((Func<KeyValuePair<string, string>, bool>)(x => x.Key == "Subject")).Select<KeyValuePair<string, string>, string>((Func<KeyValuePair<string, string>, string>)(y => y.Value)).FirstOrDefault<string>();
string str2 = mailContent.Where<KeyValuePair<string, string>>((Func<KeyValuePair<string, string>, bool>)(x => x.Key == "Salutation")).Select<KeyValuePair<string, string>, string>((Func<KeyValuePair<string, string>, string>)(y => y.Value)).FirstOrDefault<string>();
string str3 = mailContent.Where<KeyValuePair<string, string>>((Func<KeyValuePair<string, string>, bool>)(x => x.Key == "Body")).Select<KeyValuePair<string, string>, string>((Func<KeyValuePair<string, string>, string>)(y => y.Value)).FirstOrDefault<string>().Replace("\r\n", "").Replace("br/", "<br/>").Replace("/b", "<b style='font-size: 15px;'>").Replace("b/", "</b>").Replace("{{Agent_name}}", agentuser == null ? "UBRealty" : "Your agent " + agentuser.FirstName + " " + agentuser.LastName).Replace("{{PropertyOrProject}}", projectUnitLeads.ProjectHeaders != null ? "Project" : "Property").Replace("{{Property_name}}", projectUnitLeads.ProjectHeaders != null ? projectUnitLeads.ProjectHeaders.ProjectTitle : projectUnitLeads.UnitHeaders.PropertyTitle).Replace("{{Property_address}}", projectUnitLeads.ProjectHeaders != null ? projectUnitLeads.ProjectHeaders.Address : projectUnitLeads.UnitHeaders.Address);
string str4 = ConfigurationManager.AppSettings["AmazonUploadUrl"] + "/CompanyLogo/logo.png";
string fromEmailAddress = emailSettings.FromEmailAddress;
string greeting = (str2 ?? "Dear") + " " + buyeruser.FirstName + " " + buyeruser.LastName + ",";
List<string> toEmail = stringList;
string subject = str1;
string content = str3;
string companylogo = str4;
emailManager.SendEmail_Sync(fromEmailAddress, greeting, (string)null, toEmail, subject, content, (string)null, (string)null, (List<string>)null, (string)null, (string)null, companylogo);
return true;
}
public void SendEmail_Sync(
string fromEmail,
string greeting,
string userComments,
List<string> toEmail,
string subject,
string content,
string signature,
string companynameandaddress,
List<string> attachments,
string hyperlinktext,
string hyperlinkurl,
string companylogo)
{
new EmailManager.SendBackgroundMail(this.SendBackgroundMailMethod).BeginInvoke(fromEmail, greeting, userComments, toEmail, subject, content, signature, companynameandaddress, attachments, hyperlinktext, hyperlinkurl, companylogo, (AsyncCallback)null, (object)null);
}
我想在创建任何用户时将邮件发送到xx @ gmail .com