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, the func
parameter was a PopupEditTextCallback
and now it's a maxon:: 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!