Options

How could i send an email from NAV with Gmail account??

FranklinFranklin Member Posts: 253
Hi everybody,

I have a great problema... I need to send an email when i post an order but the customer don´t have Outlook. They only use Gmail...

How could i send this? I have something about this but i cant creat it.

Plz i need some help [-o<
«1

Comments

  • Options
    garakgarak Member Posts: 3,263
    you need the pop3 / smtp config infos and a pop3/smtp dll or exe.

    viewtopic.php?f=23&t=24560

    if you search the forum, you will find a lot of post. not for gmail but for the same question.
    Also search the web for the Pop3 / smtp servername of google mail and which port these servers use.

    Regards
    Do you make it right, it works too!
  • Options
    garakgarak Member Posts: 3,263
    Also you can read the google Mail help (mail.google.com).
    And if your customer has NAV 5 you can also use Microsoft.Navision.Mail.dll.
    You can look in 5.0 CU 400 on how to use it.

    Search also the forum for SMTP
    Do you make it right, it works too!
  • Options
    SavatageSavatage Member Posts: 7,142
    We use Gmail & outlook express (which comes with windows)
    http://mail.google.com/support/bin/answ ... swer=13276
  • Options
    FranklinFranklin Member Posts: 253
    Thanks for the info... i have very lost with this topic... but i´ll try it.
  • Options
    SavatageSavatage Member Posts: 7,142
    Basically Outlook Express can send & receive emails using GMAILs pop.
  • Options
    FranklinFranklin Member Posts: 253
    Thanks Savatage for the info, but my customer don´t use Outlook Express, only Gmail...

    Do you have modified something in CU 400? And how have you configurated Form 409?

    ](*,)
  • Options
    SavatageSavatage Member Posts: 7,142
    outlook is just a tool to access gmail, just like nav is a tool to get your business data.

    When you say they just use gmail do you mean they login online to gmail to create, send & retrieve emails?
    if so then outlook express will do that for you.
    in fact you don't even have to USE outlook express, but if it's set up then Windows can use it to send out emails since an SMTP has been created.
  • Options
    garakgarak Member Posts: 3,263
    The question is also: should the mail autom. be sended after the order is posted or can the outlook express window be opened to add some more infos.
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    Thanks again,

    Everybody use NAV 2009 to connecting with the server, nobody works in local. I don´t know if Windows Server 2003 have Outlook Express or not.

    The customer use Google Docs and Google Apps, they have a portal with Google, and they do everything with this application. I think they don´t wan´t to use Outlook Express. I suppose, they are always loggin.

    The mail must be send after you post the order autom., when you press F11, you post the order and if it´s all okey, the mail is sent.
  • Options
    SavatageSavatage Member Posts: 7,142
    "they do everything with this application"

    Apparently not, If you want Nav2009 to send emails or any other app then there needs to be an email program or mail server setup. As I said we use gmail to send emails to. But we DON"T USE gmail as our base email program. We just use the gmail accounts to send massive amounts of mail cheap (as in free) without having our own mail server. Outlook express never even opens when we send emails.

    An email is generated->get's thrown into out outlook express outbox->outlook express is setup using a gmail account->off it goes (all behind the scenes). If you can come up with another way then please share.
  • Options
    FranklinFranklin Member Posts: 253
    Savatage you win jejeje i don´t no much about this.

    You suppose i finally use Outlook Express to send the mail... How i have to configure NAV 2009 and the Outlook Express?? If "Outlook express never even opens when i send emails" i think this will serve the customer...

    Have i to add some code in CU 400? How is your configuration in nav form "smtp mail"?

    Sorry for my english... #-o

    EDIT: I think they have an email server with google apps... Google portal haven´t an email server? (as you can see i have not much idea about this topic ](*,) )
  • Options
    SavatageSavatage Member Posts: 7,142
    I think the first step is goto the customer and get a complete list of what they have & what they don't have. You don't seem to know if they have a mail server or not.
  • Options
    FranklinFranklin Member Posts: 253
    Hi again,

    I have news... The customer don´t have mail server and the they want this:

    - When the order is posted a mail have been sent to the director. From (gmail account of the user) To (gmail account of the director)

    - They don´t want to open any application like Outlook Express if it´s possible.

    No more... :-k :-k :-k
  • Options
    garakgarak Member Posts: 3,263
    so it's very simple.
    Store the email addres of the director and from the user. Maybe in the sales person table.
    Setup the smtp setup.
    google smtp server is:

    Mail IN Server -> POP3: pop.googlemail.com (SSL; Port 995), IMAP: imap.googlemail.com (SSL; Port 993)
    Mail Out Server -> SMTP: smtp.googlemail.com (SSL; Port 465 or 587)

    Username: Mailaddress of the user (Mailaccountname@googlemail.com)
    Important: GMail use SMTP-Authentification and for every account must the POP3/SMTP access be activated (u can do this in the settings of gmail webaccess)

    So thest all for the configure. Create your own account for testing.
    Next setup the SMTP setup to test if you can send a email from NAV.
    If all workes fine, implent the mail sending in the posting routines.

    Also you can look into the Business Notification Function.

    http://www.mibuso.com/dlinfo.asp?FileID=542

    Regards
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    Hi garak,

    I have set all and everything is ok except two things...

    In NAV i have created a function to send the mail like this...

    2 automation locals:
    - objApp ('Microsoft Outlook 12.0 Object Library'.Application)
    - objMail ('Microsoft Outlook 12.0 Object Library'.MailItem) Y luego este es el código.

    (I don´t find the 2 variables automations for Outlook Express)

    //Create application
    IF ISCLEAR(objApp) THEN CREATE(objApp);

    //Create mail item
    objMail := objApp.CreateItem(0);

    //Set properties
    objMail."To"(user@gmail.com');
    objMail.Subject('Mail from Navision');
    objMail.Body();

    //Uncomment for display email
    objMail.Display();

    //Send mail
    objMail.Send();

    First: The Outlook Must be opened to sent the mail. This is a problem.
    Second: When the mail is going to be sent it appears a security message to sent the mail. I have to let it. Could I avoid this message come out?

    And could i use other application instead of Outlook 2007? which do you recommend me? (I suppose if i use other app i have to use other automation locals, right?
  • Options
    garakgarak Member Posts: 3,263
    1. you doesn't need outlook or outlook express to send autom. a email to the smpt server
    2. u need only a smtp ocx or dll or a simple exe like blat.exe or jmail.dll or the Microsoft.Navision.Mail.dll which is used in codeunit 400
    3. did you really read the Codeunit 400 (u must have NAV 5.0 or higher to have this codeunit) there you can see all
    4. if you or your customer doesn't use NAV 5.0 or higher, you can use blat.exe or jmail.dll jmail.ocx to send mails to the smtp server

    So, where are your problems? Did you not understand, how to setup the SMTP Setup in form 409 and How to use the Codeunit 400?
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    garak wrote:
    1. you doesn't need outlook or outlook express to send autom. a email to the smpt server
    2. u need only a smtp ocx or dll or a simple exe like blat.exe or jmail.dll or the Microsoft.Navision.Mail.dll which is used in codeunit 400
    3. did you really read the Codeunit 400 (u must have NAV 5.0 or higher to have this codeunit) there you can see all
    4. if you or your customer doesn't use NAV 5.0 or higher, you can use blat.exe or jmail.dll jmail.ocx to send mails to the smtp server

    So, where are your problems? Did you not understand, how to setup the SMTP Setup in form 409 and How to use the Codeunit 400?

    Hi garak...

    Really, i don´t understand the codeunit 400 (they are using NAV 2009) ](*,), i´ll try to understand the codeunit tomorrow with some help, but if you could explain me something...

    I suppose, i have to call this codeunit somewhere (for example, after post an order) but i don´t know where to use Microsoft.Navision.Mail.dll (i think the dll is a global of CU400). Anyway i´ll try it tomorrow and i´ll tell you my progress.

    Regards, :D
  • Options
    FranklinFranklin Member Posts: 253
    Hi again...

    I have read the condeunit 400 and everything is OK!! I have sent a smtp mail =D> =D> =D>

    Thank you for your help!!! =D> =D> =D>
  • Options
    garakgarak Member Posts: 3,263
    Please and welcome
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    Hi again...

    I managed to send an email with our account, and our mail server but the customer´s smtp server is GMAIL.

    If I use CU400, I get this error when i send the mail.

    errorhbu.jpg

    The problem is, i think, Gmail needs SSL and i´m very loosed. With our accounts we don´t have problems but yes with a gmail account.

    Could someone tell me if it is possible to use the smtp of NAV with gmail accounts? :(

    EDIT: They have Microsoft CRM too. We had problems with this but CRM have an option to use SSL mail mode but not NAV.

    The gmail accounts let POP3 and IMAP (i´m sure because they are using CRM with these accounts)
  • Options
    SavatageSavatage Member Posts: 7,142
    you might also want to read up on what google has posted for gmail help & support
    http://mail.google.com/support/bin/answ ... swer=13287
    Just to cover all your bases
  • Options
    FranklinFranklin Member Posts: 253
    Savatage but...

    how i have to use the CU400 to say it that the sent have to use STARTTLS?? (this is the problem)

    that´s my question :-k

    I think that i can´t use this codeunit or .dll to send the mail with gmail server...

    If i send the mail with M$ Outlook or Outlook Express i have no problems because i can configure this parameters (SSL mode, ports...) but if you use codeunit 400 you have no fields to say it.
  • Options
    FranklinFranklin Member Posts: 253
    garak do you know something about this? :-k somebody else?
  • Options
    garakgarak Member Posts: 3,263
    This DLL doesn't support SSL.
    So, check the web for a freeware dll (like jmail or blat) that also supports ssl.
    Or if possible, and you will use CU400, check if it exist in the web a dll that establ. a ssl tunnel before.
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    Hi again... :oops:

    For now I won´t use SMTP. I´ll use Outlook Express to send a mail...

    What Automation variables do i need to sent it with Outlook Express?
  • Options
    ara3nara3n Member Posts: 9,255
    take a look at CU 397 Mail. use this codeunit to send email through your default email program.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    FranklinFranklin Member Posts: 253
    why crash in this code?

    IF (NOT OApplication.Logon(TRUE,'','',FALSE,FALSE)) THEN BEGIN
    OApplication.Logoff;
    EXIT
    END;

    What should I do to Logon the application? Have i to configure something else?

    (My code is
    cuMail.NewMessage('toaccount@gmail.com','','testsubject','testbody','',TRUE);
    cuMail.Send();) :-k
  • Options
    garakgarak Member Posts: 3,263
    Other question: Do you have a senior developer in your firm who has some year exirience in C/AL programming?
    Do you make it right, it works too!
  • Options
    FranklinFranklin Member Posts: 253
    Nop, we have only one year programming. I do all basic developments but there are some advanced knowledge that i don´t
    know!! #-o

    Forums are basic for me to advance.
  • Options
    garakgarak Member Posts: 3,263
    Maybe because u doesn't have Outlook and you doesn't have installed the NAV Client correct (can u compile the cu 397?) ;-)

    So, if you only use O-Express, you can use for example the Microsoft MAPI Messages Control, version 6.0 ocx (MSMAPI32.OCX).
    Do you make it right, it works too!
Sign In or Register to comment.