C++ Builder 6 - Send Mail

Hi,

is there a function to send a mail in C++ Builder?

Kind Regards,
Rowin

Comments

  • Yes, use a TNMSMTP Component (under the FastNet in the Component Palette). Put it on the Form and set its Properties correctly. Then the code is simple:

    [code]
    NMSMTP1->Connect();
    NMSMTP1->SendMail();
    NMSMTP1->Disconnect();
    [/code]

    This looks simple, but I do not always get it to work...
    Good luck!
    bilderbikkel

  • : Yes, use a TNMSMTP Component (under the FastNet in the Component Palette). Put it on the Form and set its Properties correctly. Then the code is simple:
    :
    : [code]
    : NMSMTP1->Connect();
    : NMSMTP1->SendMail();
    : NMSMTP1->Disconnect();
    : [/code]
    :
    : This looks simple, but I do not always get it to work...
    : Good luck!
    : bilderbikkel
    :
    :


    Hi,

    Thanks for the reply'
    It's just now that I tried it since I didn't have time.

    I've done the following:

    NMSMTP1->Connect();
    NMSMTP1->PostMessage->ToAddress->Text="rrowin7@hotmail.com";
    NMSMTP1->SendMail();
    NMSMTP1->Disconnect();

    But I got the error:
    NULL REMOTE ADDRESS.

    Do you have any idea why?

    Thanks,
    Rowin


  • Hi Rowin,

    great that I can help you once in a while!
    I see you change the NMSMTP1::PostMessage::ToAddress::Text at run-time. I first got the thing running by setting all properties (also the ones I did not understand) at design-time. From then on, I'd gradually shift to run-time configuration.

    Very very perhaps, you should use:
    [code]
    NMSMTP1->PostMessage->ToAddress->Text->Add("myEmail@somewhere.tk");
    [/code]
    but that's just a wild guess...

    If you can set it at design-time and need help setting the same properties at run-time, I look forward to your posts!

    See ya,
    bilderbikkel

  • : Hi Rowin,
    :
    : great that I can help you once in a while!
    : I see you change the NMSMTP1::PostMessage::ToAddress::Text at run-time. I first got the thing running by setting all properties (also the ones I did not understand) at design-time. From then on, I'd gradually shift to run-time configuration.
    :
    : Very very perhaps, you should use:
    : [code]
    : NMSMTP1->PostMessage->ToAddress->Text->Add("myEmail@somewhere.tk");
    : [/code]
    : but that's just a wild guess...
    :
    : If you can set it at design-time and need help setting the same properties at run-time, I look forward to your posts!
    :
    : See ya,
    : bilderbikkel
    :


    Hi,

    There are some properties that I'm not sure what to set.

    What value should I put in the Host, UserId and FromAddress?

    Thanks,
    Rowin

  • : There are some properties that I'm not sure what to set.
    : What value should I put in the Host, UserId and FromAddress?

    I have had the same problem. Then I checked the manual, by pressing F1 on the class. Success,
    bilderbikkel

  • : : There are some properties that I'm not sure what to set.
    : : What value should I put in the Host, UserId and FromAddress?
    :
    : I have had the same problem. Then I checked the manual, by pressing F1 on the class. Success,
    : bilderbikkel
    :
    :
    I don't understand what value to put in the Host...

    Thanks,
    Rowin
  • : : There are some properties that I'm not sure what to set.
    : : What value should I put in the Host, UserId and FromAddress?
    :
    : I have had the same problem. Then I checked the manual, by pressing F1 on the class. Success,
    : bilderbikkel
    :
    :

    Hi,

    have you ever seen something like:
    CreateOleObject("Outlook.Application")

    do you know how to use it?

    Thanks,
    Rowin
  • : I don't understand what value to put in the Host...
    I also think this is the most 'difficult' one. When you are connected to a network, you have to give in the network name. E.g. at my university it is 'biol.fmns.nl'. Just try all stuff out. If you use the 'My Network Place' tool you see the connections you have.

    I hope it works!


    bilderbikkel

  • : have you ever seen something like:
    : CreateOleObject("Outlook.Application")
    Yes. They allow communication between applications. They are difficult to master as they depend on string parsing. I've once written a program that can read all cells from an excel sheet (saved in Excel, not in plain text). I checked the web and found what I was looking for.

    See ya,
    bilderbikkel

  • : : have you ever seen something like:
    : : CreateOleObject("Outlook.Application")
    : Yes. They allow communication between applications. They are difficult to master as they depend on string parsing. I've once written a program that can read all cells from an excel sheet (saved in Excel, not in plain text). I checked the web and found what I was looking for.
    :
    : See ya,
    : bilderbikkel
    :
    :
    Hi,

    I've been able to do it.
    I've done the following:

    Variant MSOutlook ;
    Variant MailMessage ;

    MSOutlook = CreateOleObject("Outlook.Application") ;

    MailMessage = MSOutlook.OleFunction("CreateItem" , (Variant)0) ;

    MailMessage.OlePropertySet("TO" ,".....@...com" ) ;

    MailMessage.OlePropertySet("Subject" , "Testing Mail!!!") ;

    MailMessage.OlePropertySet("Body" , "The test is successful :)" ) ;

    MailMessage.OleFunction("Send");

    Kind Regards,
    Rowin
  • Good stuff Rowin!
    I have put your name and code on the CodePedia http://www.codepedia.com/1/CppVclSendEmail

    Everybody will love you now ;-)

    See ya,
    bilderbikkel

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories