You need to sign in to do that
Don't have an account?
Federico Larsen
send mail through S-Control
Hi there,
I tryied this code to send an Email from a S-Control using the Toolkit AJAX, but even though the EmailMessage is created an associeted with the case, the Email is not processed by the Salesforce mail Server, so the Email Message appears like Sent but is Not.
function sendMail(){
setMsg("Sending Email Message...");
var ts = sforceClient.GetServerTimestamp().timeStamp;
_mail = new Sforce.Dynabean("EmailMessage");
_mail.set("FromAddress", "anyadress@myserver.com");
_mail.set("FromName", "Any Name");
_mail.set("HasAttachment", false);
_mail.set("Incoming", false);
_mail.set("MessageDate", ts);
_mail.set("ParentId", caseId);
_mail.set("FromName", "Any Name");
_mail.set("Subject", "Any Subject");
_mail.set("TextBody", "test envio from sforce-control\ntest envio from sforce-control\ntest envio from sforce-control");
_mail.set("ToAddress", "marcelo@virtualcompanyservices.com");
_mail.set("BccAddress", "federico.larsen@gmail.com");
sforceClient.Create([_mail], mailCallback);
}
function mailCallback(saveResult) {
if (saveResult[0].success == true) {
setMsg("Sending Mail. OK");
closeReload();
} else {
setMsg("Error sending mail: " + saveResult[0].errors[0].message);
}
}
Thanks a lot in advance for your help.
Federico.-
I tryied this code to send an Email from a S-Control using the Toolkit AJAX, but even though the EmailMessage is created an associeted with the case, the Email is not processed by the Salesforce mail Server, so the Email Message appears like Sent but is Not.
function sendMail(){
setMsg("Sending Email Message...");
var ts = sforceClient.GetServerTimestamp().timeStamp;
_mail = new Sforce.Dynabean("EmailMessage");
_mail.set("FromAddress", "anyadress@myserver.com");
_mail.set("FromName", "Any Name");
_mail.set("HasAttachment", false);
_mail.set("Incoming", false);
_mail.set("MessageDate", ts);
_mail.set("ParentId", caseId);
_mail.set("FromName", "Any Name");
_mail.set("Subject", "Any Subject");
_mail.set("TextBody", "test envio from sforce-control\ntest envio from sforce-control\ntest envio from sforce-control");
_mail.set("ToAddress", "marcelo@virtualcompanyservices.com");
_mail.set("BccAddress", "federico.larsen@gmail.com");
sforceClient.Create([_mail], mailCallback);
}
function mailCallback(saveResult) {
if (saveResult[0].success == true) {
setMsg("Sending Mail. OK");
closeReload();
} else {
setMsg("Error sending mail: " + saveResult[0].errors[0].message);
}
}
Thanks a lot in advance for your help.
Federico.-
Ok, I understand that and I am agree.
So, How would you send an Email from a S-Control?
Thanks in advance for your help
In general, since we don't provide a "method" or api interface for sending an email you are tasked with trying to do it from js. This can be done if you use outlook and an activex control from your js, but requires a bit of overhead for browser trust etc.
I was tyring to do it in a api-friendly way, but now you said so, I will try to find another way, maybe using /email/author/emailauthor.jsp
Thanks a lot for your information.
Federico.-