Sending a mail-unix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • electroon
    New Member
    • Jan 2008
    • 8

    Sending a mail-unix

    Hi Frnds,

    I have a task in my project wherein i have to send out a mail from my C++ code.With some file attachements.Pl ease help me in this.

    At a higher level wat i can tell is my code generated 3 csv file and i have to send these files as attachement.

    My code is executed in unix server.So please suggest me how to do this.

    If possible also please tell me how to do this in windows also.

    Thanks in advance please reply asap.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    What have you tried on this? What have you researched? Have you looked into sendmail?

    Comment

    • electroon
      New Member
      • Jan 2008
      • 8

      #3
      Originally posted by sicarie
      What have you tried on this? What have you researched? Have you looked into sendmail?
      No actually i was exploring on this i found some very complex code so still working on this

      Comment

      • gpraghuram
        Recognized Expert Top Contributor
        • Mar 2007
        • 1275

        #4
        Originally posted by electroon
        No actually i was exploring on this i found some very complex code so still working on this

        If you can use exec/system call then what u can do is to call the mail command from that.
        If you are OK with this i can provide you with more information

        Raghuram

        Comment

        • electroon
          New Member
          • Jan 2008
          • 8

          #5
          Ya that should should be fine can u please help me on this
          And i wanted one more info is there any way in unix shell scripting where in i call this executable and after the end of the execution of this executable the same shell script triggers off a mail with the files genereated by the executable as attachement.

          Thanks for the reply

          Comment

          • sicarie
            Recognized Expert Specialist
            • Nov 2006
            • 4677

            #6
            The system() and exec() calls execute commands as if they were run on the command line, and only return pass or fail. So while you can use a shell command to create mail and send it out, this is not recommended when you have email APIs that you can dig into, as your system() command would end up looking something like

            system("command 1 and all its options ; command 2 and its options | into command 3 and its options | lots and lots and lots of text here depending on what you're sending ; and hope command 4 runs");

            And you'd spend days trying to figure out where you went wrong there when you could just use an API to address, attach, and send email, it'll save you quite a bit of headaches.

            Originally posted by electroon
            Ya that should should be fine can u please help me on this
            And i wanted one more info is there any way in unix shell scripting where in i call this executable and after the end of the execution of this executable the same shell script triggers off a mail with the files genereated by the executable as attachement.

            Thanks for the reply
            Huh? Okay, so you're going to create an exe to do who knows what, and once that completes, you want a program to attach those files and send them? Two separate programs? Or are you trying to create attachments of sent emails? I don't understand what you are asking there.

            Comment

            • oler1s
              Recognized Expert Contributor
              • Aug 2007
              • 671

              #7
              Just as a small warning: the system command does execute some program on the command line. The exec command does not. Unlike the use of exec in many other languages, exec does not simply run a program. It is used to replace the current process with another one.

              Comment

              Working...