Solved

Command_SYS.Mail(

  • 7 October 2020
  • 13 replies
  • 2769 views

Userlevel 5
Badge +8

 

Our company moved to office 365 and the mail port and protocol changed. I adjusted the mails sent from the events tab in IFS. I cannot run mails sent from PLSQL. Where can I change the settings?

 

With the following settings, mails sent from the events tab work.

 

 

 

 

Working mail is not working for the example procedure below.

PROCEDURE SISTEM_BILGISI
IS

parameter_attr_    VARCHAR2(2000);
      result_key_        NUMBER;
      report_attr_       VARCHAR2(2000);
      msg_               VARCHAR2(32000); 
      print_job_id_      NUMBER;
      attr_              VARCHAR2(4000);
      date_              DATE;
      attach_            VARCHAR2(2000);
      text_              VARCHAR2(32766);
      subject_           VARCHAR2(2000);
      deger_           VARCHAR2(2000);
      
   BEGIN
       IFSAPP.Log_SYS.Init_Debug_Session_('en');
  

   
          Command_SYS.Mail(
            from_user_name_ => 'IFSAPP',
            to_user_name_ => 'ayilmaz@sefine.com.tr',
          ---  cc_ => 'ayilmaz@sefine.com.tr',
            text_ => 'vvvvvvv' ,
            attach_ => attach_,
            subject_ => 'aaaaaa' );
            
   General_SYS.Init_Method(Sfn_Bt_Tcr_To_Ask_Util_API.lu_name_, 'Sfn_Bt_Tcr_To_Ask_Util_API', 'SISTEM_BILGISI');
END SISTEM_BILGISI;

I am waiting for your valuable information.

icon

Best answer by CallumW 15 October 2020, 16:42

View original

13 replies

Userlevel 7
Badge +24

Hi @ADNAN 

Is there an error appearing when executing the code?

If not, then check the IFS page Application Messages / Notifications queue.  You’ll probably see a failure message saying that the mail sender is not configured correctly.

Userlevel 5
Badge +8

 

hi

@paul harland 

The problem is there I can send an e-mail from the e-mail I choose with Default Instance, but I cannot send an e-mail with an e-mail address that I did not choose as Default in PL SQL.

 

 

 

but the mail goes with defaul chosen.

 

 

Userlevel 7
Badge +24

I’m not sure but I think I understand the question...

If using an IFS Event Action, choose the mail sender here (Apps 10)

If doing it through the API, you can submit the mail sender as a parameter here in Command_sys.mail

 

Userlevel 4
Badge +11

Hi Adnan ( @ADNAN ),

Have you considered using the UTL_SMTP Oracle package instead of Command_Sys.Mail?

https://oracle-base.com/articles/misc/email-from-oracle-plsql

https://www.morganslibrary.org/reference/pkgs/utl_smtp.html

Useful resources above.

I find it much more powerful and suits my use cases perfectly.

Cheers,

Pete

Userlevel 5
Badge +8

hi @paul harland 

 

no sender parameters :(

 

PROCEDURE SISTEM_BILGISI
IS

parameter_attr_    VARCHAR2(2000);
      result_key_        NUMBER;
      report_attr_       VARCHAR2(2000);
      msg_               VARCHAR2(32000); 
      print_job_id_      NUMBER;
      attr_              VARCHAR2(4000);
      date_              DATE;
      attach_            VARCHAR2(2000);
      text_              VARCHAR2(32766);
      subject_           VARCHAR2(2000);
      deger_           VARCHAR2(2000);
      
   BEGIN
       IFSAPP.Log_SYS.Init_Debug_Session_('en');
  

   
          Command_SYS.Mail(
            from_user_name_ => 'AYILMAZ',
            to_user_name_ => 'ayilmaz@xxx.com.tr',
          ---  cc_ => 'ayilmaz@sefine.com.tr',
            text_ => 'vvvvvvv' ,
            attach_ => attach_,
            subject_ => 'aaaaaa' );
            
   General_SYS.Init_Method(Sfn_Bt_Tcr_To_Ask_Util_API.lu_name_, 'Sfn_Bt_Tcr_To_Ask_Util_API', 'SISTEM_BILGISI');
END SISTEM_BILGISI;

Userlevel 6
Badge +15

Press these in blue

 

The other two options for COMMAND_SYS.MAIL have mail_sender

 

Userlevel 5
Badge +8

 hi @CallumW 

it says the variable number is wrong.

 

 

it says the variable number is wrong.

Userlevel 6
Badge +15

Your Mail Sender is called MUT_MAIL_SENDER not ayilmaz@XX.com.tr

Userlevel 5
Badge +8

@CallumW

The problem I'm having is not the parameter value.

The number of error variable types the procedure gave me is wrong.

 

Userlevel 6
Badge +15

Use the other one. The one you are using is expecting a table for the attachments - you are sending it text.

COMMAND_SYS.Mail(sender_      => 'IFS Applications!',
from_ => 'ayilmaz@xx.com.tr',
to_list_ => 'ayilmaz@xx.com.tr',
cc_list_ => '',
bcc_list_ => '',
subject_ => 'Subject',
text_ => 'Text',
attach_ => '',
rowkey_ => '',
mail_sender_ => 'MUT_MAIL_SENDER');

 

Userlevel 5
Badge +8

@CallumW  thank you so much.

Badge +1

Hey, I tried to directly pass a file path into attach_  but it does not work, should I do something before this to make sure I’m able to send the mail including the attachment. Thanks in advance 

Badge +1

 I’m seeing this error, when I add the local file path in attach_ in command_sys method, any idea why i’m seeing this error? 

Reply