Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to send a email in Informix 4gl

How to send a email in Informix 4gl

How to send a email in Informix 4gl

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


RE: How to send a email in Informix 4gl

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:


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: How can Informix 4GL interact with Unix?

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:


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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close