# Automatic email documents generated out of Epicor **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2016-10-06 15:18 UTC **Views:** 19845 **Replies:** 29 **URL:** https://www.epiusers.help/t/automatic-email-documents-generated-out-of-epicor/35719 --- ## Post #1 by @Manasa I know many of you have done this and we are getting ready to do this here. We want to be able to generate invoices and then automatically email them to the customer. What are you using to accomplish this? We also want to be able to send off shipping documents and other docs at various times or various points within our process. I do not care if it is expensive, cheap is always good...and if it doesn't require a lot of work that is always best! But right now I am looking at what options are out there to do this. Thanks! Manasa --- ## Post #2 by @jgiese.wci On 10 are you using SSRS? Joshua Giese Technology Solutions : CTO Direct Phone: 920.593.8299 Office Phone: 920.437.6400 x342 [http://wcibags.com/email/emailFooter4.jpg] --- ## Post #3 by @josecgomez Your best bet is APM though in 10.1 epicor introduced some advanced document routing to auto print. I know u guys are not in 10.1 yet, but it might be worth t the jump for this feature --- ## Post #4 by @jgiese.wci To elaborate major difference is data you want used in the emails as content from APM you are basically doing a screen scrape it has to be on the report somewhere static can’t move. With the solution in 10.1 you are using metadata from the dataset and can pretty much do whatever the hell you want. Joshua Giese Technology Solutions : CTO Direct Phone: 920.593.8299 Office Phone: 920.437.6400 x342 [http://wcibags.com/email/emailFooter4.jpg] --- ## Post #5 by @MiguelS We currently use DocuSender from DotNetIT for Invoices, PO, and ORder Acknowledgement. --- ## Post #6 by @Manasa We are on 10.700.4 and we do a combination of Crystal and SSRS. Manasa --- ## Post #7 by @Manasa It looks like we will go down this road then...part of our upgrade....fun! M --- ## Post #8 by @Manasa thanks, Miguel....at least something else to compare APM to....Manasa --- ## Post #9 by @Chris_Conn If you have access to an SMTP email server, it is pretty straightforward to send email using custom C# code in BPM (I have never used built in EMAIL object). I can share code if you like. You could always generate your report to a local PDF, then attach it in email. --- ## Post #10 by @Manasa Hhhmmm…Chris, I may take you up on that….would you be willing to talk of list to discuss more? M. Manasa Reddy P: 703.471.7145 x454 manasa@euclidsys.com --- ## Post #11 by @Chris_Conn This is the code I used within a form customization - It should be the same except for in a BPM you can use MssageBox.Show, you have to use the ICE message box. I hope this helps! I would also like to note, you can use your GMAIL account for SMTP as well if you use the right settings. -Chris SmtpClient smtpClient = new SmtpClient(); NetworkCredential basicCredential = new NetworkCredential("uremail@domain.com", urpassword); MailAddress fromAddress = new MailAddress("WhoIsSender@domain.com"); smtpClient.Host = "mail.yourSMTP.com"; smtpClient.Port = 25; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = basicCredential; MailMessage message = new MailMessage(); //-------> THIS IS WHAT YOU WANT! ---->message.Attachments.Add(new Attachment(PathToAttachment)); message.From = fromAddress; message.Subject = "Testing customiztion from E10"; //Set IsBodyHtml to true means you can send HTML email. message.IsBodyHtml = true; ` message.Body = "

This was created from within EPICOR..


On the receipt entry screen";` message.To.Add("receipient1@domain.com"); try { smtpClient.Send(message); } catch(Exception ex) { //Error, could not send the message // Response.Write(ex.Message); MessageBox.Show(ex.Message); }
--- ## Post #12 by @Manasa Cool, thank you….we shall try it. ☺ M. Manasa Reddy P: 703.471.7145 x454 manasa@euclidsys.com --- ## Post #13 by @Chris_Conn Sorry for the typo's I meant to say you CANT use MessageBox.Show in a BPM. Also, dont forget to add these directives: using System.Net; using System.Net.Mail; --- ## Post #14 by @josecgomez Pretty nice @Chris_Conn , For what its worth if you are in a BPM you can use the built in Epicor Mailer class to send SMTP email with attachments. This makes it a little simpler since it will use the configured Epicor SMTP settings that you've already established when you setup Epicor. ```cs var mailer = this.GetMailer(async: true); var message = new Ice.Mail.SmtpMail(); message.SetFrom("email@email.com"); message.SetTo("email1@email.com;email2@email.com"); //message.SetCC() //message.SetBcc() message.SetBody("

MyMessage Here

"); Dictionary attachments = new Dictionary(); attachments.Add("MyFirstAttachment", @"\\MyServer\myFolder\MyFile.pdf"); mailer.Send(message, attachments); ``` --- ## Post #15 by @Manasa Got it! M. Manasa Reddy P: 703.471.7145 x454 manasa@euclidsys.com --- ## Post #16 by @Chris_Conn Nice, I have never used the email object - I have no control over the system configuration so I wasn't sure if an SMTP was even configured. For future reference, is that simply configured in the SYSCONFIG? I think I saw some params for that. --- ## Post #17 by @josecgomez The one that BPM uses is configured in Company Configuration --- ## Post #18 by @DaveOlender Mr. Gomez: Thank you so much for the code. I ran a quick test and it works! I must admit I was thinking this was going to be much more complicated - But it really is straight forward. Thank you again, DaveO --- ## Post #19 by @Manuel_Moreno Jose, thanks for this great information. I need assistance on this, this is the scenario: I have a csv file in this location: E:\Epicor\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt My server name is : ERP10-APP I already tried @"\\Epicor\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt" @"\\ERP10-APP\Epicor\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt" and does not work, no even email received. but if I try : @"E:\Epicor\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt" , i works but i am getting an attachment that is not the one I want. it is like an video recorder installation program .dat I am confuse because I do not where Epicor is attaching this program from. thanks for any help on this regards Manuel --- ## Post #20 by @josecgomez Are you doing this on a BPM? If so the file needs to be in the Epicor Server. --- ## Post #21 by @Manuel_Moreno yes, I am doing this in a BPM and the file is stored in the app server. well, now it is working and getting my correct attachment using this @"E:\Epicor\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt" thanks a lot for your support M --- ## Post #22 by @Vincent Hi is that possible to use C# custom to print to email instead of using the APM, I may want to try auto print the statement with criteria if matched with some addition note in my email, and attach the statement automatically. My logic customization in Order Entry screen user able to send the statement to customer by just click the button, and all the works will be handle by C# coding internally. Thanks. --- ## Post #23 by @jgiese.wci Yes. Best to do it on the BPM side of things, but you can generate invoices, statements, etc then attach and email. --- ## Post #24 by @Vincent Hi jgiese, nice to hear that may I have some reference on this? of the sample code. --- ## Post #25 by @jgiese.wci I could provide you my code however I'm not sure it would work for you and it's a significant amount. I know that until 10.2.500 some of the stuff I'm using to achieve what you are doing is not available. My suggestion use traces on report printing to figure out what you need for code to reproduce that part of it, and if I had to guess sending BPM emails from code, even with attachments, is probably already in the forum somewhere. --- ## Post #26 by @Vincent Yes if possible please, just for my reference so that I can have an idea on how to route to other parameter. --- ## Post #27 by @Cycl3 does @"\ERP10-APP\EpicorData\Companies\iei\BankVendorFile\Live\LiveVendor.txt" work? looking at my server share it is the "EpicorData" folder instead of "Epicor" --- ## Post #28 by @Brian_Chandler @Vincent: Do you mean that you want to auto attach an SSRS report to an email and send? --- ## Post #29 by @Vincent Hi Brian, Thanks and I discover there's SSRS Breaking/Routing which able to perform this. --- ## Post #30 by @asmar We also have Advance Printing/Routing. I am able to auto-email an SSRS report/style. However, How do I include an attachment? We don't have DocStar. Is there away to do this? Could you share your solution. --- **Canonical:** https://www.epiusers.help/t/automatic-email-documents-generated-out-of-epicor/35719 **Original content:** https://www.epiusers.help/t/automatic-email-documents-generated-out-of-epicor/35719