Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Best way to get a program to send emails

Best way to get a program to send emails

Scheduled Pinned Locked Moved C / C++ / MFC
c++htmlhostingcloudquestion
15 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Anorexic Tribble

    I am writing a membership program in C++ and MFC (Yes I know that is old hat these days!) and I want it to be able to send HTML emails with attachments and use BCC list. My initial attempt uses MAPI functions. This has two problems : 1) If the application is built as a UNICODE application, but the MAPI client is MBCS (or visa versa) then the MAPI calls fail. 2) Not all mail clients are MAPI compliant. Outlook is, but Outlook Express and various shareware mail clients are not. Also a lot of people use cloud based systems. What method can I use to send emails that will work with most (if not all) Windows systems?

    C Offline
    C Offline
    CPallini
    wrote on last edited by
    #3

    Let's look if Code Project has articles for you: "SEND MAIL C++" search results[^].

    A 1 Reply Last reply
    0
    • C CPallini

      Let's look if Code Project has articles for you: "SEND MAIL C++" search results[^].

      A Offline
      A Offline
      Anorexic Tribble
      wrote on last edited by
      #4

      Thank you for stating the bleeding obvious. I have already done that. It comes up with a list of articles (277 of them) with those words in them. It does not come up with a recommendation of which of the many methods is the most flexible; which one overcomes the 32/64 bit problem; what the pros and cons of each method are. The Code Project search engine, whilst very good at finding words in articles, is ill equipped to give recommendations. I have already tried one of the articles (Using extended MAPI) and found problems with it. Rather than trying the other 276 articles in turn, I thought I would seek advice on the matter from the friendly people at Code Project. I find that asking humans these sorts of questions yields better results. Well most of the time anyway. Occasionally you get someone who has had a bad day and feels the need to take it out on someone else. If you don't know the answer to my question or you don't understand the question then don't be shy. Let me know and I will try to explain myself in more simpler terms for you.

      enhzflepE C 3 Replies Last reply
      0
      • A Anorexic Tribble

        Thank you for stating the bleeding obvious. I have already done that. It comes up with a list of articles (277 of them) with those words in them. It does not come up with a recommendation of which of the many methods is the most flexible; which one overcomes the 32/64 bit problem; what the pros and cons of each method are. The Code Project search engine, whilst very good at finding words in articles, is ill equipped to give recommendations. I have already tried one of the articles (Using extended MAPI) and found problems with it. Rather than trying the other 276 articles in turn, I thought I would seek advice on the matter from the friendly people at Code Project. I find that asking humans these sorts of questions yields better results. Well most of the time anyway. Occasionally you get someone who has had a bad day and feels the need to take it out on someone else. If you don't know the answer to my question or you don't understand the question then don't be shy. Let me know and I will try to explain myself in more simpler terms for you.

        enhzflepE Offline
        enhzflepE Offline
        enhzflep
        wrote on last edited by
        #5

        At which point in your original question did you make mention of the fact that you had in fact done some degree of research, particularly that you had reviewed CP's articles? If you don't state what you've done, how can you expect someone not to suggest the very same thing? Furthermore, you make mention that you realize MFC is old hat, which is irrelevant, yet make no mention of research, only of the failings of your initial attempt. Frankly, your reply post is one I consider rather rude and I'd be surprised to learn I was alone in thinking like this. I hope the rest of your day improved/s.

        "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

        J D 2 Replies Last reply
        0
        • enhzflepE enhzflep

          At which point in your original question did you make mention of the fact that you had in fact done some degree of research, particularly that you had reviewed CP's articles? If you don't state what you've done, how can you expect someone not to suggest the very same thing? Furthermore, you make mention that you realize MFC is old hat, which is irrelevant, yet make no mention of research, only of the failings of your initial attempt. Frankly, your reply post is one I consider rather rude and I'd be surprised to learn I was alone in thinking like this. I hope the rest of your day improved/s.

          "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #6

          enhzflep wrote:

          reply post is one I consider rather rude

          That's bleeding obvious! :)

          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst

          enhzflepE 1 Reply Last reply
          0
          • J jeron1

            enhzflep wrote:

            reply post is one I consider rather rude

            That's bleeding obvious! :)

            "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst

            enhzflepE Offline
            enhzflepE Offline
            enhzflep
            wrote on last edited by
            #7

            Touché! :-\

            1 Reply Last reply
            0
            • A Anorexic Tribble

              Thank you for stating the bleeding obvious. I have already done that. It comes up with a list of articles (277 of them) with those words in them. It does not come up with a recommendation of which of the many methods is the most flexible; which one overcomes the 32/64 bit problem; what the pros and cons of each method are. The Code Project search engine, whilst very good at finding words in articles, is ill equipped to give recommendations. I have already tried one of the articles (Using extended MAPI) and found problems with it. Rather than trying the other 276 articles in turn, I thought I would seek advice on the matter from the friendly people at Code Project. I find that asking humans these sorts of questions yields better results. Well most of the time anyway. Occasionally you get someone who has had a bad day and feels the need to take it out on someone else. If you don't know the answer to my question or you don't understand the question then don't be shy. Let me know and I will try to explain myself in more simpler terms for you.

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #8

              You are welcome. And sorry if I have no interest in your 'simpler terms'.

              1 Reply Last reply
              0
              • A Anorexic Tribble

                Thank you for stating the bleeding obvious. I have already done that. It comes up with a list of articles (277 of them) with those words in them. It does not come up with a recommendation of which of the many methods is the most flexible; which one overcomes the 32/64 bit problem; what the pros and cons of each method are. The Code Project search engine, whilst very good at finding words in articles, is ill equipped to give recommendations. I have already tried one of the articles (Using extended MAPI) and found problems with it. Rather than trying the other 276 articles in turn, I thought I would seek advice on the matter from the friendly people at Code Project. I find that asking humans these sorts of questions yields better results. Well most of the time anyway. Occasionally you get someone who has had a bad day and feels the need to take it out on someone else. If you don't know the answer to my question or you don't understand the question then don't be shy. Let me know and I will try to explain myself in more simpler terms for you.

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #9

                You are welcome. And sorry if I have no interest in your 'simpler terms'.

                1 Reply Last reply
                0
                • enhzflepE enhzflep

                  At which point in your original question did you make mention of the fact that you had in fact done some degree of research, particularly that you had reviewed CP's articles? If you don't state what you've done, how can you expect someone not to suggest the very same thing? Furthermore, you make mention that you realize MFC is old hat, which is irrelevant, yet make no mention of research, only of the failings of your initial attempt. Frankly, your reply post is one I consider rather rude and I'd be surprised to learn I was alone in thinking like this. I hope the rest of your day improved/s.

                  "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #10

                  enhzflep wrote:

                  If you don't state what you've done, how can you expect someone not to suggest the very same thing?

                  I disagree. In addition to everything else, we're also supposed to be mind readers and know what the OP wants. ;)

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                  enhzflepE 1 Reply Last reply
                  0
                  • A Anorexic Tribble

                    I am writing a membership program in C++ and MFC (Yes I know that is old hat these days!) and I want it to be able to send HTML emails with attachments and use BCC list. My initial attempt uses MAPI functions. This has two problems : 1) If the application is built as a UNICODE application, but the MAPI client is MBCS (or visa versa) then the MAPI calls fail. 2) Not all mail clients are MAPI compliant. Outlook is, but Outlook Express and various shareware mail clients are not. Also a lot of people use cloud based systems. What method can I use to send emails that will work with most (if not all) Windows systems?

                    D Offline
                    D Offline
                    Dar Brett
                    wrote on last edited by
                    #11

                    I'm not really familiar with the stuff you're using, and I haven't used C++ for a few years, but from what I remember any functions in the Windows API that changed between character types depending on precomiler definitions had other similarly named functions. I remember the function to show a message box was called MessageBox(), and internally it mapped to either MessageBoxA() or MessageBoxW() depending on precompiler definitions. Maybe you'll find something similar with your function for sending the mail? Then depending on how speedy you need it to run you could write some code to attempt the other version of the function if the first try failed, or if you need it faster try to detect what the MAPI client needed you to use and have some kinda fancy interface, function pointer, etc to convert your text and send it using the right format. Alternatively, you could try using .Net from C++ to use all of the email junk built into that - though I'm kinda assuming you're avoiding needing to install the entire .Net framework alongside your application.

                    1 Reply Last reply
                    0
                    • A Anorexic Tribble

                      I am writing a membership program in C++ and MFC (Yes I know that is old hat these days!) and I want it to be able to send HTML emails with attachments and use BCC list. My initial attempt uses MAPI functions. This has two problems : 1) If the application is built as a UNICODE application, but the MAPI client is MBCS (or visa versa) then the MAPI calls fail. 2) Not all mail clients are MAPI compliant. Outlook is, but Outlook Express and various shareware mail clients are not. Also a lot of people use cloud based systems. What method can I use to send emails that will work with most (if not all) Windows systems?

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #12

                      You should investigate SMTP (Simple Mail Transfer Protocol), which is the most common one in use. I am not aware of any MFC classes that support it, but it should be easy enough to find out.

                      1 Reply Last reply
                      0
                      • D David Crow

                        enhzflep wrote:

                        If you don't state what you've done, how can you expect someone not to suggest the very same thing?

                        I disagree. In addition to everything else, we're also supposed to be mind readers and know what the OP wants. ;)

                        "One man's wage rise is another man's price increase." - Harold Wilson

                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                        enhzflepE Offline
                        enhzflepE Offline
                        enhzflep
                        wrote on last edited by
                        #13

                        :) Of course, I'd forgotten about the famed CPMRU - I think I needed to order more batteries, it's been sitting on the shelf collecting dust for a while and doesn't function at present.

                        1 Reply Last reply
                        0
                        • A Anorexic Tribble

                          I am writing a membership program in C++ and MFC (Yes I know that is old hat these days!) and I want it to be able to send HTML emails with attachments and use BCC list. My initial attempt uses MAPI functions. This has two problems : 1) If the application is built as a UNICODE application, but the MAPI client is MBCS (or visa versa) then the MAPI calls fail. 2) Not all mail clients are MAPI compliant. Outlook is, but Outlook Express and various shareware mail clients are not. Also a lot of people use cloud based systems. What method can I use to send emails that will work with most (if not all) Windows systems?

                          M Offline
                          M Offline
                          Michael Haephrati
                          wrote on last edited by
                          #14

                          Use this class[^]

                          - Michael Haephrati מיכאל האפרתי

                          A 1 Reply Last reply
                          0
                          • M Michael Haephrati

                            Use this class[^]

                            - Michael Haephrati מיכאל האפרתי

                            A Offline
                            A Offline
                            Anorexic Tribble
                            wrote on last edited by
                            #15

                            Many thanks. I'll give it a try.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups