Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send a email in Informix 4gl 1

Status
Not open for further replies.

numericInteger

Programmer
Jul 4, 2007
1
US
Hi all! I would like to send an email to customer by using Informix 4gl. Is that possible?? Any sample code to guide me? Thank you

regards,
Newbies.
 
I'm assuming that you are executing Informix 4GL from a Unix/Linux system and you want to send email from the Unix system to your customer from within an Informix 4GL program.

While Informix 4GL can execute any valid unix command - including mailx or mail - Informix 4GL doesn't contain mail transfer capability. For that, you have to use a mail transfer program such as the Unix/Linux sendmail program. Whatever transfer program you use, it must be setup first before email can be transferred with Informix 4GL.

If the unix mail or mailx commands now work from the command line, they can be called from Informix 4GL.

Assume your email is contained in ASCII file myfile, this command sends the contents to user eds@myserver:

Code:
main
define mystring char(40)

let mystring = "mailx eds@myserver < myfile"
run mystring

end main

The above code works, but it's clumsy to build the ASCII file.

In this FAQ:

faq179-2007

I presented "C" functions callable by Informix 4GL. This opens a pipe to the mailx command that allows writing strings to the pipe. When the pipe closes, the strings are emailed:

Code:
main
define xx smallint,
       sstd char(80)

whenever error continue

let xx = rx_shopenw("mailx eds@myserver", 0)  #open a valid unix command
let xx = rx_shwrite("send line 1", 0)  # write to the pipe
let xx = rx_shwrite("send line 2", 0)
call rx_shclose(0)  #be sure to close the pipe

end main

The FAQ shows you how to set up the "C" functons used in the above code. Let me know if you have any questions.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top