Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

c++ form processing

  • 24-09-2003 12:40am
    #1
    Closed Accounts Posts: 364 ✭✭


    Hi

    Im wondering can anyone help me here with this little question. Basically I have been writing form processing programs in c++ and have gotten them to run seccesfully. What I do is I use the post method and have my data sent that way. I can parse that data and get all the variables i need assigned their values, such as 'name=Andrew' and 'emailaddy=sean1033@gmx.fi', but i want to be able to have that data emailed to myself also when the user clicks on the submit button. Anyone in here know how I could pipe the data to an email program such as sendmail? My choice environment is a unix environment. I ask here as a last resort because most info on this topic on the net is based on perl scripts. I prefer c++.

    Thanks in advance

    Matt


Comments

  • Registered Users, Registered Users 2 Posts: 95 ✭✭fractal


    Hmmm.....

    First of all I'd say you'd be better off to get to like perl or php or something better suited to the web.. C++ truly is a monster when it comes to programming a simple form.. Hmmm.. But heres what you could probably do..

    Use a system call.. ie:

    #include<stdlib.h>
    :
    :
    system("/usr/sbin/sendmail -t -O QueueDirectory=/tmp -O
    DeliveryMode=i < msg.txt");

    Where msg.txt is the mail file that looks like this:
    To: papaya@fruit.com
    From: eager@fruitflies.com
    Subject: Time is on my side
    First and last line of the message.

    Alternativley change the < msg.txt bit to the actual message you want to send from within the program and all should be well.. Really the only tricky bit would be to construct the string, that is your e-mail msg with headers, correctly.

    Twould really really be much easier if you just used php and mail()
    http://ie2.php.net/manual/en/ref.mail.php

    DISCLAMER: Never used c++ for this sorta thing before.. I expect there may be a much easier way.


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    system(); is eeeevil. Eeeevil i tell you!@#


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    Bah.

    Just do the SMTP via a socket


  • Closed Accounts Posts: 364 ✭✭Matfinn


    Fractal

    Many thanks for your reply. It will help alot. Good man. These things are impossible to find on the net.

    Matt


Advertisement