Variable in curl
Jul 15, 2017 at 8:32am UTC
Hi everyone.I am using curl in c++.This thing works for ail but if i want a program that takes input receiver's mail and send the mail to them.
i wrote this code but its not working.Can you please help me out.
Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main(void ){
char b[100];
cout<<"Reciver's mail" ; gets_s(b);
char * command = "curl smtp://smtp.gmail.com:587 -v --mail-from \"Miteshgulecha@gmail.com\" --mail-rcpt --include b --ssl -u Miteshgulecha@gmail.com:Password -T \"mail1.txt\" -k --anyauth" ;
WinExec(command, SW_HIDE);
return 0;
}
Jul 17, 2017 at 10:08am UTC
please reply...
Jul 17, 2017 at 10:42am UTC
It seems you do not send the content of
b
. Instead you send b:
char * command = "curl smtp://smtp.gmail.com:587 -v --mail-from \"Miteshgulecha@gmail.com\" --mail-rcpt --include b --ssl -u Miteshgulecha@gmail.com:Password -T \"mail1.txt\" -k --anyauth" ;
Maybe something like this:
1 2 3 4
char command[1024]; // 1k buffer
strcpy(command, "curl smtp://smtp.gmail.com:587 -v --mail-from \"Miteshgulecha@gmail.com\" --mail-rcpt --include " );
strcpy(command, b);
strcpy(command, " --ssl -u Miteshgulecha@gmail.com:Password -T \"mail1.txt\" -k --anyauth" );
It would be easier with c++ std::string.
Jul 17, 2017 at 10:53am UTC
i used this but it doesnot execute the curl command...
Topic archived. No new replies allowed.