Jade Smtp class
Posted: Fri Aug 07, 2009 1:02 pm
by ConvertFromOldNGs
by
Justin >> Mon, 16 Oct 2006 5:51:54 GMT
Now, I only can send email in two mail accounts with same domain name. Has anyone know how to sent a email to other mailbox account(it's domain is different with the mail server) via Jade CnSmtpConnection class?
E.g.
From address :
from@A.com
To address :
to@B.com
Thanks!
Regards,
Justin
Re: Jade Smtp class
Posted: Fri Aug 07, 2009 1:02 pm
by ConvertFromOldNGs
by BeeJay >> Mon, 16 Oct 2006 23:17:36 GMT
Justin,
As long as the smtp server you are using allows mails to be sent using the supplied from address, then there should be no issues with sending to an e-mail address with a different domain name to the from address.
eg: I use the following code to achieve this, where the property values are properties on my e-mail request class but there are most certainly different domains on the from and to addresses.
Note: Most smtp servers have rules in place to stop the use of foreign from addresses in an effort to reduce spam. Could this be causing you problems?
Cheers,
BeeJay.
sendEmail() updating;
vars
smtp : CnSmtpConnection ;
fileName : String ;
attachment : CnAttachment ;
file : File ;
begin
if not app.getProfileString(app.getIniFileName,"EmailInterface", "Enabled", "true").Boolean then
return;
endif;
create smtp transient;
smtp.name := "smtp.somewhere.com" ;
smtp.sendTo := to_addresses ;
smtp.cc := cc_addresses;
smtp.bcc := bcc_addresses;
smtp.message := msg_text ;
smtp.subject := msg_subject ;
smtp.sendFrom := from_address ;
smtp.contentType := contentType ;
smtp.encodingType := "Base64" ;
foreach fileName in attach_files do
create attachment transient ;
attachment.fileName := fileName ;
attachment.encodingType := "Base64" ;
attachment.mySmtpConnection := smtp ;
endforeach;
// Note: The smtp object will be deleted when the e-mail has completed it's send
// The notification will go back to the application app.beginNotification( smtp, CnSmtpConnection.Completion_Event_Type, Response_Cancel, CnSmtpConnection.Completion_Event_Type );
smtp.send ;
epilog
delete file ;
end;
Re: Jade Smtp class
Posted: Fri Aug 07, 2009 1:02 pm
by ConvertFromOldNGs
by Justin >> Wed, 18 Oct 2006 5:36:52 GMT
BeeJay, Thanks!
Regards,
Justin