Recommend a C or C++ code to send a basic email using the SMTP protocol - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: Recommend a C or C++ code to send a basic email using the SMTP protocol

  1. #16
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,783

    Re: Recommend a C or C++ code to send a basic email using the SMTP protocol

    Quote Originally Posted by Computer_Science View Post
    @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. 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/

    C++17 Compiler: Microsoft VS2017 (15.4.0)

  2. #17
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,573

    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

  3. #18
    Join Date
    Apr 2017
    Posts
    10

    Re: Recommend a C or C++ code to send a basic email using the SMTP protocol

    Quote Originally Posted by 2kaud View Post
    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 nsdonaldwebmail@gmail.com nsdonaldwebmail@gmail.com 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 nsdonaldwebmail@gmail.com'
    <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

  4. #19
    Join Date
    Apr 2017
    Posts
    10

    Re: Recommend a C or C++ code to send a basic email using the SMTP protocol

    Quote Originally Posted by Igor Vartanov View Post
    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.

Page 2 of 2 FirstFirst 12

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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)