|
-
May 1st, 2017, 04:40 PM
#16
Re: Recommend a C or C++ code to send a basic email using the SMTP protocol
 Originally Posted by Computer_Science
@2kaud do you know if getting the code to compile in VS IDE will also compile in a JNI implementation?
Sorry, no. I only use VS.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 9th, 2017, 04:05 PM
#17
Re: Recommend a C or C++ code to send a basic email using the SMTP protocol
As far as I know, JNI stands for Java Native Interface. So, the question is: why would anybody need SMTP be coded in C/C++, when there must be lots of Java packages doing the same, but natural Java way?
Best regards,
Igor
-
October 10th, 2017, 10:47 PM
#18
Re: Recommend a C or C++ code to send a basic email using the SMTP protocol
 Originally Posted by 2kaud
Because VS IDE automatically sets up the required correct build environment and uses the correct options with cl to compile the program - whereas Netbeans IDE isn't.
@2kaud , I finally got the code above to compile using your pre-requisite header information and variables for the new c++ standard. I also am not using Netbeans IDE, instead I am using Microsoft Visual Studio. I also did not realize it was not a '.c' file but a '.cpp' file. After the code is compiled run the command "SENDMAIL.exe smtp.gmail.com [email protected] [email protected] message.txt"
<p>where I include text in the 'message.txt'.
<p> The result of the program is 'Sent message.txt as email message to [email protected]'
<p> but when I check my outbox and inbox the message sent from the c++ program is not there.
<p> I know that the program connects to the internet, because when I disconnect my wifi and run the program I get "Cannot find SMTP mail server smtp.gmail.com"
<p> What can I do now to test the email being sent?
<p> Finally shouldn't the c++ program include login(username,password) to authenticate with gmail? like the "PasswordAuthentication"-Session variable in this example: https://www.tutorialspoint.com/javam...mple_email.htm
-
October 10th, 2017, 10:53 PM
#19
Re: Recommend a C or C++ code to send a basic email using the SMTP protocol
 Originally Posted by Igor Vartanov
As far as I know, JNI stands for Java Native Interface. So, the question is: why would anybody need SMTP be coded in C/C++, when there must be lots of Java packages doing the same, but natural Java way?
I needed this for an Android implementation as an alternate to not being able to find working library examples for the javamail example. Got the javamail working, but now I want to learn about the C/C++ implementation.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|