About PopupEditText and SendMail
-
Hi @anoano, first of all, I would like to point you to our Q&A functionality please use it.
As you figured PopupEditText has changed, thefunc
parameter was aPopupEditTextCallback
and now it's amaxon:: Delegate
.About SendMail, it was removed and replaced by a totally new interface SmtpMailInterface.
Here a basic example which makes use of both.
class CommandSendEmail : public CommandData { INSTANCEOF(CommandSendEmail, CommandData) private: String txt; public: void MailRecieverChangeCallback(POPUPEDITTEXTCALLBACK nMode, const maxon::String& text) { switch (nMode) { case POPUPEDITTEXTCALLBACK::TEXTCHANGED: GePrint(text); break; case POPUPEDITTEXTCALLBACK::CLOSED: txt = text; SendEmail(); break; default: break; } }; Bool SendEmail() { // Create a reference to smtpMailInterface iferr(maxon::SmtpMailRef smtp = maxon::SmtpMailRef::Create()) return false; // Define the subject iferr(smtp.SetSubject("Email Send from C4d"_s)) return false; // Define the sender iferr(smtp.SetSender("[email protected]"_s, "Random Email"_s)) return false; // Add text to this email iferr(smtp.AttachText("This is the content of the email"_s)) return false; // Define the list of receiver maxon::SmtpReceiver receiverList[] = { maxon::SmtpReceiver(txt, maxon::String()) }; iferr(smtp.SetReceiver(receiverList)) return false; // Define our login/password iferr(smtp.SetUserPassword("UserName"_s, "Password"_s)) return false; // Finally send the email with your SMTP server and port 25 iferr(smtp.SendMimeMail("SMTPServer"_s, 25)) GePrint(err.GetMessage()); else GePrint("Email sent to:" + txt); return true; }; Bool Execute(BaseDocument* doc) { if (!doc) return false; PopupEditText(0, 0, 200, 50, "Email Receiver"_s, [this](POPUPEDITTEXTCALLBACK index, maxon::String& name) { MailRecieverChangeCallback(index, name); }); return true; }; static CommandSendEmail* Alloc() { return NewObjClear(CommandSendEmail); } };
Note that you can find all the changes in API Change List in R20.
If you have any questions please let me know.
Cheers,
Maxime! -
Thank you for making the sample.
I tried it immediately, but I got an error with maxon :: SmtpReceiver.
I want to include network_smtpmail.h but I do not know the location of the file.
Where is the file? -
You can now use it after adding a path.
-
I added network_smtpmail.h, but when I build it
LINK 2001 error has occurred.
External symbol "" public: static class maxon :: InterfaceReference maxon :: SmtpErrorInterface :: _ interface "(? _Interface @ SmtpErrorInterface @ maxon @@ 2VInterfaceReference @ 2 @ A)" is unresolvedHow can I solve this?
-
All interfaces or functions/classes that are part of the new core are stored in the maxon folder. So you have to write
#include "maxon/network_smtpmail.h"
.Moreover, you have to make sure network.framework is included. You can have an overview of each framework here or either you can go on the header file and on the bottom left the framework is written. For your case take a look at network_smtpmail.h.
I hope it solves your issue. Please let me know.
Cheers,
Maxime! -
I could write #include "maxon / network_smtpmail.h" and load it successfully.
But then I get a message that SmtpErrorInterface and SmtpMailInterface can not be resolved.There was an error when opening network_smtpmail1.hxx and network_smtpmail2.hxx.
How can I do this?
-
Just a dumb question: Did you include the maxon framework in your projectdefinition and did you run the project tool after that?
-
I do it in the following procedure
-
Create project file with project_tool
-
Add network.framework to frameworks
-
Add path in include directory from project properties![alt text]
\ sdk \ frameworks \ network.framework \ source
\ sdk \ frameworks \ network.framework \ generated \ hxx
-
-
Hi @anoano how did you add the network.framework?
With the R20 you shouldn't manually create your solution or add anything to it, the project tool will take care of it.
The usual way would be:- Add the framework to your projectdefinition.txt located in plugins\YourProjectDir\project\
- Add network.framework to the API entry.
- (Re-)run the project tool, which will update your solution for visual studio/xcode with the new framework.
- This is also valid when you create/remove a file in order to get a synchronized solution for both Windows and Mac OS.)
- Open the solution in VS/Xcode and Compile.
You can find information about projectdefinition.txt and project tool here.
Cheers,
Maxime. - Add the framework to your projectdefinition.txt located in plugins\YourProjectDir\project\
-
Error did not come out safely.
I did not understand how to use projectdefinition.txt.
You can proceed with this.
Thank you very much. -
Hi @anoano
I'm wondering if your question has been answered. If so, please mark this thread as solved.
Cheers,
Maxime.