Sending a mail by using JMail Automation failed

fortius_cvafortius_cva Member Posts: 70
Hi all
I have a scenario of sending a mail from the appover when he tries to approve a document(India Localization).To address the above scenario, i had used the MAPI Handler which is not giving the client satisfaction.

Now i am trying to send that approval mail by using SMTP which was addressed in 5.0 n not in 4.0.I am using the JMail to meet the requirement.I am making use of the below said sample code to send an sample mail for testing purpose and i am unable to do it.

sample code :

IF ISCLEAR(JMailB) THEN
CREATE(JMailB);
JMailB.Logging := TRUE;
JMailB.From('<from>@b2bsoftech.com');
JMailB.FromName('Shiva');
JMailB.AddRecipient('<To>@b2bsoftech.com');
JMailB.Subject('Indent Approval');
JMailB.AppendText('');
JMailB.AppendText('');
JMailB.HTMLBody('<a href=' + 'Test' + '</a>');
JMailB.AppendText('');

OK := JMailB.Send('mail.b2bsoftech.com');
IF NOT OK THEN BEGIN
TxtError := JMailB.ErrorMessage;
MESSAGE('Error: %1',TxtError);
END;
MESSAGE('ok = %1',FORMAT(OK));
JMailB.Close;

Which is giving me the error(checkout the attchment).


Off-Course i am having the complete access to the SMTP Server.
Thank You
********
Friend Ship is just like breeze.. you can't smell it, touch it,hold it.
********

Comments

  • ara3nara3n Member Posts: 9,256
    Are you trying to send an html email or text email?

    Try to comment out JMailB.HTMLBody('<a href=' + 'Test' + '</a>');
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • fortius_cvafortius_cva Member Posts: 70
    Hi Rasheed,

    I am trying to send an Text E-Mail.
    Thank You
    ********
    Friend Ship is just like breeze.. you can't smell it, touch it,hold it.
    ********
  • fortius_cvafortius_cva Member Posts: 70
    I have commented the Body and i have cheked it out .But still the problem persists...
    Thank You
    ********
    Friend Ship is just like breeze.. you can't smell it, touch it,hold it.
    ********
  • ara3nara3n Member Posts: 9,256
    does your mail server have login and password? what kind of mail server is it? And is smtp enabled?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    In most cases it is because the SMTP server refuse the request or you used wrong SMTP server address. Check that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • fortius_cvafortius_cva Member Posts: 70
    Hi all,
    Thanks for your valuable suggestions.I am able to send the mail using the JMail.

    Could any one tell me the code to move to the next line in the body section of the Mail.

    My body section should appear as below
    Dear Sir,

    PI-0910-0020is approved and ready to order

    Thanks & Regards
    xxxxxxxxxx


    Bosy section is appearing as
    Dear Sir,PI-0910-0020is approved and ready to orderThanks & Regardsxxxxxxx
    Thank You
    ********
    Friend Ship is just like breeze.. you can't smell it, touch it,hold it.
    ********
  • PeterDPeterD Member Posts: 66
    You need to create a new line.

    Try this:
    chrCr := 13;
    chrLf := 10;
    txtCrLf := STRSUBSTNO('%1%2', chrCr, chrLf);
    autJMailMessage.AppendText(txtCrLf);
    
Sign In or Register to comment.