Fail to send an email message Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
smallwolf
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sun Aug 26, 2007 11:02 pm

Fail to send an email message

Post by smallwolf » Tue Mar 17, 2009 9:58 pm

hello:

i want to send an email message in my wxWidgets application,but fail.
what's wrong with this code?
the following code aren't compiled.
with error,
[Linker Error] undefined reference to `wxEmail::Send(wxMailMessage&, wxString const&, wxString const&)'


Code: Select all

#include <wx/net/msg.h>
#include <wx/net/email.h>

        wxString subject="this is the subject";
	wxString to="[email protected]";
	wxString body="body of the email - hello wxWidgets" ;
	
        wxMailMessage email(subject,     // subject
                    to,        // TO:
                    body  // body
                    );


         bool ok= wxEmail::Send(email);
         if(ok)
         wxMessageBox("Send OK");
         else
         wxMessageBox("Send Failed");
Have a nice day!

User avatar
doublemax
Moderator
Moderator
Posts: 14876
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Tue Mar 17, 2009 10:31 pm

you need to compile the netutils lib from the contrib directory and add it to your project.
Use the source, Luke!

smallwolf
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sun Aug 26, 2007 11:02 pm

Post by smallwolf » Wed Mar 18, 2009 1:06 am

doublemax wrote:you need to compile the netutils lib from the contrib directory and add it to your project.

thanks!
It finally compiled,but i got the "Send fail" message box.
is there anything wrong?


have a nice day!

User avatar
doublemax
Moderator
Moderator
Posts: 14876
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Wed Mar 18, 2009 1:59 am

hard to tell. This class doesn't actually send the email itself, it requires a MAPI compatible email program with fully configured email account to be installed.

Maybe you can trace through the Send() method and see where it fails.
Use the source, Luke!

smallwolf
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sun Aug 26, 2007 11:02 pm

Post by smallwolf » Thu Mar 19, 2009 1:19 am

doublemax wrote:hard to tell. This class doesn't actually send the email itself, it requires a MAPI compatible email program with fully configured email account to be installed.

Maybe you can trace through the Send() method and see where it fails.

thanks. i set up the outlook program .
when i press the button"send", the outlook program pop out,and it fill up with the information that i assigned in my wxWidgets
program. i have to press the button "send" in the outlook program in order to send the message.

Post Reply