Auto E-Mail to Customer

snehasneha Member Posts: 191
Hi ,

When user ships Sales Order, want to send automatic E-Mail to customer. Can you please give me some ideas, if it already discussed?

Comments

  • KarenhKarenh Member Posts: 209
    You could modify codeunit 81 as follows:

    //SalesPost.RUN(SalesHeader);
    IF Ship THEN BEGIN
    if SalesPost.RUN(SalesHeader) THEN
    EmailCust(SalesHeader);
    END ELSE
    SalesPost.RUN(SalesHeader);

    ******
    You need to add a function to codeunit 81 EmailCust. It would use the Mail codeunit 397.

    It would be something like:

    Cust.GET(SalesHeader."Sell-To Customer No.");
    IF Cust."E-Mail" <> '' THEN BEGIN

    BodyText := 'Whatever you want to say, perhaps include sales order no.';
    Mail.NewMessage(ECust."E-Mail" ,'',You Order has shipped',BodyText,'',FALSE);

    END;
    END;
  • davmac1davmac1 Member Posts: 1,283
    If you are on release 5, you should look at using codeunit 400 instead of 397. It provides more flexibility.
    If you want to send a pdf copy of the invoice, then you have to print the invoice to a pdf then attach it to the email.
  • ara3nara3n Member Posts: 9,256
    I would make the emailing a separate process. Waiting on sending email will slow down posting.
    Write another processing report that will mark the posted document and then email the notification.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • snehasneha Member Posts: 191
    Karenh wrote:
    You could modify codeunit 81 as follows:

    //SalesPost.RUN(SalesHeader);
    IF Ship THEN BEGIN
    if SalesPost.RUN(SalesHeader) THEN
    EmailCust(SalesHeader);
    END ELSE
    SalesPost.RUN(SalesHeader);

    ******
    You need to add a function to codeunit 81 EmailCust. It would use the Mail codeunit 397.

    It would be something like:

    Cust.GET(SalesHeader."Sell-To Customer No.");
    IF Cust."E-Mail" <> '' THEN BEGIN

    BodyText := 'Whatever you want to say, perhaps include sales order no.';
    Mail.NewMessage(ECust."E-Mail" ,'',You Order has shipped',BodyText,'',FALSE);

    END;
    END;

    I followed your idea. At the same time I keep in mind ara3n advice. In this scenario, I need some more help on
    1. How can I default From Address (irrespective of user)?
    2. How to add signature in outlook body (default)?
  • MeenakshiMeenakshi Member Posts: 14
    edited 2013-07-10
    Hi All,
    I have the same question as to how can I define the Email From address(irrespective of user) using MAIL codeunit?
    Working in NAV 4 (SP3) native database.

  • davmac1davmac1 Member Posts: 1,283
    you need codeunit 400 to specify the from address. If your license includes release 5, then export codeinit 400 from a release 5 datebase and import it into your release 4.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Codeunit 400 is not that flexible... It only uses port 25 for SMTP. Which most ISP blocks because of spammers.
  • rsaritzkyrsaritzky Member Posts: 469
    I've had great success with a product called ANSMTP from http://www.emailarchitect.net. This company has email libraries for ActiveX/COM/.NET/etc for both SMTP and POP applications. I do not have a lot of experience with developing ActiveX/.NET apps (strictly a C/Side guy), but I was able to build some very sophisticated email capabilities into NAV. I also built an email template form where the users could type in a template for an email message, giving them the ability to modify the text of the message easily.

    ANSMTP has access to every field in an email, e.g. "From Address", "To Address" "cc address", "subject", "body", etc. The documentation is excellent and their website has dozens of examples in VB, VBA, .NET, etc. Their email support is very responsive, and the package is only $150 for a single developer (multiple clients), and you can download and use any of their libraries for 30 days for free.

    Regards,

    Ron
    Ron
  • ara3nara3n Member Posts: 9,256
    you can use Jmail and it has similar capabilities. and there are example available on mibuso.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.