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. Linking Input to an email output

Linking Input to an email output

Scheduled Pinned Locked Moved C / C++ / MFC
c++helplearning
3 Posts 3 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.
  • B Offline
    B Offline
    B Rock
    wrote on last edited by
    #1

    I am building a rather simple dialog program that receives input, however, I am having trouble linking this generated output to be transmitted in email form through outlook explorer. I am still pretty much a beginner programer in C++, so any help would be appreciated. Thanks B-rock B-Rock

    A N 2 Replies Last reply
    0
    • B B Rock

      I am building a rather simple dialog program that receives input, however, I am having trouble linking this generated output to be transmitted in email form through outlook explorer. I am still pretty much a beginner programer in C++, so any help would be appreciated. Thanks B-rock B-Rock

      A Offline
      A Offline
      Alex Griffing
      wrote on last edited by
      #2

      I'm getting very frustrated with trying to send email from my computer programmatically. From what I've been able to find out, there are two choices: - use MAPI: problem: It pops up dialog boxes requiring user input when it is unable to send messages or when various errors happen. Therefore it is not useful to me since I want to run the program on a computer that isn't being looked at by a human. - use SMTP: problem: You need a computer that you can connect to on port 25 and say HELO\r\nMail From: a@b.c\r\nRCPT To: x@y.z\r\ndata\r\nfirstline\r\nlastline\r\n.\r\nQUIT\r\n or whatever. In any case I don't have a computer that I can send this through so I can't do this either. But check out the code below for an example of doing MAPI. You have to put a line of code each of mapi init and uninit and include mapi.h. The functions i call at the end here just display the appropriate error message according to a switch statement using strings taken from the msdn docs. hope it helps. /* CMfcserverDlg::Mail(CString subject, CString text) { LPMAPISENDMAIL lpfnMAPISendMail = (LPMAPISENDMAIL) GetProcAddress (m_mapiModule,"MAPISendMail"); LPMAPILOGON lpfnMAPILogon = (LPMAPILOGON) GetProcAddress (m_mapiModule,"MAPILogon"); LPMAPILOGOFF lpfnMAPILogoff = (LPMAPILOGOFF) GetProcAddress (m_mapiModule,"MAPILogoff"); LHANDLE lhSession = 0; char subject[] = "this is the subject"; char message_text[] = "automated\r\nhello\r\nthis is the message text\r\nblah\r\nblah\r\nblah\r\ngoodbye"; char str_originator_name[] = "alexander the originator"; char str_recip_name[] = "alexander the recipient"; char str_originator_address[] = "snowman@north.pole"; char str_recip_address[] = "SMTP:agriffing@hotmail.com"; MapiRecipDesc originator; originator.ulReserved = 0; originator.ulRecipClass = MAPI_ORIG; originator.lpszName = str_originator_name; originator.lpszAddress = str_originator_address; originator.ulEIDSize = 0; originator.lpEntryID = 0; MapiRecipDesc recip; recip.ulReserved = 0; recip.ulRecipClass = MAPI_TO; recip.lpszName = str_recip_name; recip.lpszAddress = str_recip_address; recip.ulEIDSize = 0; recip.lpEntryID = 0; MapiMessage msg; msg.ulReserved = 0; msg.lpszSubject = subject; msg.lpszNoteText = message_text; msg.lpszDateReceived = 0; msg.lpszConversationID = 0; msg.flFlags = 0; msg.lpOriginator = &originator; msg.nRecipCount = 1; msg.lpRecips = &recip; msg.nFileCount = 0; msg.lpFiles = 0; ULONG ret; ret = lpfnMAPILogon(0, 0, 0, 0, 0, &lhS

      1 Reply Last reply
      0
      • B B Rock

        I am building a rather simple dialog program that receives input, however, I am having trouble linking this generated output to be transmitted in email form through outlook explorer. I am still pretty much a beginner programer in C++, so any help would be appreciated. Thanks B-rock B-Rock

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        If you want to use Outlook Express or whatever it is, that is your default email client, try this. Use ShellExecute and open "mailto:aaa@aaa.com" replace aaa@aaa.com with your target email address I hope I got your question correct. Nish

        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