public void AddEMail(eMail mail) { MongoDatabase mongoDatabase = this._mongoServer.GetDatabase("email_user_" + this._id); MongoCollection <eMailEntity> mongoCollection = mongoDatabase.GetCollection <eMailEntity>("mails"); eMailAddress headerFrom = new eMailAddress(this.Username, this.eMail); mail.SetReplyTo(this.Username, this.eMail); eMailEntity mailEntity = new eMailEntity { Time = mail.Time, MailFrom = mail.MailFrom, HeaderReplyTo = mail.HeaderReplyTo, Subject = mail.Subject, RecipientTo = mail.RecipientTo, ClientName = "eMailServer.NET", Message = mail.Message, HeaderFrom = headerFrom, RawHeader = mail.RawHeader }; WriteConcernResult result = mongoCollection.Insert(mailEntity, WriteConcern.Acknowledged); logger.Info("WriteConcernResult: " + result.Ok); }
public void AddEMail(eMail mail) { MongoDatabase mongoDatabase = this._mongoServer.GetDatabase("email_user_" + this._id); MongoCollection<eMailEntity> mongoCollection = mongoDatabase.GetCollection<eMailEntity>("mails"); eMailAddress headerFrom = new eMailAddress(this.Username, this.eMail); mail.SetReplyTo(this.Username, this.eMail); eMailEntity mailEntity = new eMailEntity { Time = mail.Time, MailFrom = mail.MailFrom, HeaderReplyTo = mail.HeaderReplyTo, Subject = mail.Subject, RecipientTo = mail.RecipientTo, ClientName = "eMailServer.NET", Message = mail.Message, HeaderFrom = headerFrom, RawHeader = mail.RawHeader }; WriteConcernResult result = mongoCollection.Insert(mailEntity, WriteConcern.Acknowledged); logger.Info("WriteConcernResult: " + result.Ok); }