
SBarnes wrote:How can you send an email from Jiwa with an attachment without needing to show the email form?

JiwaFinancials.Jiwa.JiwaApplication.JiwaEmail.EmailMessage emessage = this.Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaEmail.EmailMessage>(null);
emessage.CreateNew();
emessage.EmailSubject = string.Format("Attached {0}",filename);
JiwaFinancials.Jiwa.JiwaApplication.Documents.Document documentAttachment = this.Manager.CollectionItemFactory.CreateCollectionItem<JiwaFinancials.Jiwa.JiwaApplication.Documents.Document>();
documentAttachment.PhysicalFileName = newFile;
using (System.IO.FileStream stream = new System.IO.FileStream(newFile, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
using (System.IO.BinaryReader reader = new System.IO.BinaryReader(stream))
{
documentAttachment.FileBinary = reader.ReadBytes((int)stream.Length);
}
}
emessage.EmailFrom = this.Manager.Staff.EmailAddress;
emessage.EmailTo = this.Manager.Staff.EmailAddress;
emessage.Attachments.Add(documentAttachment);
emessage.Save();

Return to Technical and or Programming
Users browsing this forum: No registered users and 4 guests