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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.