Re: [development-axapta] SysMailer class
try to add SMTP relay server befpre sending: mailer.SMTPRelayServers().add(SMTPServerName); --- Martin Sujkowski [EMAIL PROTECTED] wrote: Hi everyone, I copied the send email example code from SysMailer help file and put it in a job. It goes like this: SysMailer mailer = new SysMailer(); mailer.body(This is the body of the mail); mailer.subject(Eureka! Axapta generated and email); mailer.fromAddress([EMAIL PROTECTED]); mailer.fromName(Joe Smith); mailer.tos().add([EMAIL PROTECTED]); //mailer.attachments().add(c:\\gylle.log); mailer.sendMail(); print 'done'; pause; The job executes fine but it is extremly slow. At least 15-20 seconds for an email with a single receipient (mailer.sendMail() is where it chugs). Does anyone have a clue why that could be and if so how to fix it? Paulius Cerniauskas ICQ: 280959446 __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com SPONSORED LINKS Computer part Programming languages Microsoft axapta Support exchange YAHOO! GROUPS LINKS Visit your group "development-axapta" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [development-axapta] SysMailer class
Hi The reason the mail transmission is slow is that you've not provided any (quick) means for SysMailer to resolve the email address that you are sending to. This means that SysMailer (or to be more precise, the underlying dsmailer.dll) has to use the Internet's root name servers to find the name IP address of the destination domain's mail server and they are typically heavily loaded. If you have a local smart host email server (i.e. an SMTP server that will forward emails for you) then you can massively speed up the process by leaving that to send the email. When you do this, SysMailer only has to deliver the email to your local smart host and Axapta can just carry on. The smart host will then forward the email using its own name resolution mechanism and will handle stuff like retries if the destination mail server is off line, etc. Your own mail server can do this job for you although you may find that some configuration changes will be needed to allow your Axapta client to use it. This is because standard practice for mail server configuration is to restrict which client machines are allowed to forward mail through the mail server. You may find, therefore, that the machine you are running the Axapta client on is blocked from using the mail server for this purpose. You can check this as follows Get to a command prompt. Type telnet x.x.x.x 25 and enter where x.x.x.x is the IP address of your smart host mail server. Type helo y.y.y.y and enter where y.y.y.y is your IP address. Note that the telnet won't echo back the characters that you type so you will have to type carefully. Type mail from:[EMAIL PROTECTED] and enter where [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] is your email address Type rcpt to:[EMAIL PROTECTED] and enter where [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] is a valid external email address If you are being blocked you will get an error message at this point. If no error then... Type Data and enter Type a dummy message and then enter Type . and enter Type quit and enter If you're able to get through all that without an error displayed at the point when you specify the external email address then your mail server is allowing you to send external mail from the client that you executed this on. Note that if you are running a thin client Axapta connection and your SysMailer code is going to run on the server then you will need to perform this test from the AOS. To get SysMailer to use the smart host you need to add the following to your code... sysMailer.SMTPRelayServers().add(smartHost) Note that the SySEmailParameters table has a field that you can use to hold the smart host name, so you could set that up and use... sysMailer.SMTPRelayServers().add(sysEmailParameters::find().SMTPRelaySer verName) If you do get the error and you cannot get your systems admin people to reconfigure your mail server to allow you to route external mail through it then there is an alternative... You can also give SySMailer a local DNS Server to enable it to resolve the destination email domain locally and avoid the overhead of using the root servers. You'll need to know the IP address of your LAN DNS server. There is a SysMailer method that can be used to add a DNS server to its DNSServers collect, but the last time I tried to use it it crashed Axapta (service pack 3). The alternative is to create your own class that extends SysMailer and override the new() method on your child class adding the code... COM dnsServers; ; super(c); dnsServers = _com.DNSServers(); dnsServers.add(IP address of your DNS server); Doing this anyway isn't a bad idea as it means you can use sysMailer's validateAddress method to check for valid email addresses. So, in summary, always use a smart host (relay server) if you can because its the fastest way of doing things and you are offloading the need to handle offline or busy destination mail servers. If you cannot use a smart host then use a local DNS Server. If you want to validate your destination email address then use a local DNS server anyway. Avoid using the root DNS servers at all costs. Hope that helps Regards Malcolm Burtt Touchstone People, Partnerships, Solutions _ From: development-axapta@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sujkowski Sent: 07 March 2006 18:35 To: development-axapta@yahoogroups.com Subject: [development-axapta] SysMailer class Hi everyone, I copied the send email example code from SysMailer help file and put it in a job. It goes like this: SysMailer mailer = new SysMailer(); mailer.body(This is the body of the mail); mailer.subject(Eureka! Axapta generated and email); mailer.fromAddress([EMAIL PROTECTED]); mailer.fromName(Joe Smith); mailer.tos().add([EMAIL PROTECTED]); //mailer.attachments().add(c:\\gylle.log); mailer.sendMail(); print 'done'; pause; The job executes fine but it is extremly slow. At least 15-20 seconds for an email with a single
RE: [development-axapta] SysMailer class
Hi The reason the mail transmission is slow is that you've not provided any (quick) means for SysMailer to resolve the email address that you are sending to. This means that SysMailer (or to be more precise, the underlying dsmailer.dll) has to use the Internet's root name servers to find the name IP address of the destination domain's mail server and they are typically heavily loaded. If you have a local smart host email server (i.e. an SMTP server that will forward emails for you) then you can massively speed up the process by leaving that to send the email. When you do this, SysMailer only has to deliver the email to your local smart host and Axapta can just carry on. The smart host will then forward the email using its own name resolution mechanism and will handle stuff like retries if the destination mail server is off line, etc. Your own mail server can do this job for you although you may find that some configuration changes will be needed to allow your Axapta client to use it. This is because standard practice for mail server configuration is to restrict which client machines are allowed to forward mail through the mail server. You may find, therefore, that the machine you are running the Axapta client on is blocked from using the mail server for this purpose. You can check this as follows Get to a command prompt. Type telnet x.x.x.x 25 and enter where x.x.x.x is the IP address of your smart host mail server. Type helo y.y.y.y and enter where y.y.y.y is your IP address. Note that the telnet won't echo back the characters that you type so you will have to type carefully. Type mail from:[EMAIL PROTECTED] and enter where [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] is your email address Type rcpt to:[EMAIL PROTECTED] and enter where [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] is a valid external email address If you are being blocked you will get an error message at this point. If no error then... Type Data and enter Type a dummy message and then enter Type . and enter Type quit and enter If you're able to get through all that without an error displayed at the point when you specify the external email address then your mail server is allowing you to send external mail from the client that you executed this on. Note that if you are running a thin client Axapta connection and your SysMailer code is going to run on the server then you will need to perform this test from the AOS. To get SysMailer to use the smart host you need to add the following to your code... sysMailer.SMTPRelayServers().add(smartHost) Note that the SySEmailParameters table has a field that you can use to hold the smart host name, so you could set that up and use... sysMailer.SMTPRelayServers().add(sysEmailParameters::find().SMTPRelaySer verName) If you do get the error and you cannot get your systems admin people to reconfigure your mail server to allow you to route external mail through it then there is an alternative... You can also give SySMailer a local DNS Server to enable it to resolve the destination email domain locally and avoid the overhead of using the root servers. You'll need to know the IP address of your LAN DNS server. There is a SysMailer method that can be used to add a DNS server to its DNSServers collect, but the last time I tried to use it it crashed Axapta (service pack 3). The alternative is to create your own class that extends SysMailer and override the new() method on your child class adding the code... COM dnsServers; ; super(c); dnsServers = _com.DNSServers(); dnsServers.add(IP address of your DNS server); Doing this anyway isn't a bad idea as it means you can use sysMailer's validateAddress method to check for valid email addresses. So, in summary, always use a smart host (relay server) if you can because its the fastest way of doing things and you are offloading the need to handle offline or busy destination mail servers. If you cannot use a smart host then use a local DNS Server. If you want to validate your destination email address then use a local DNS server anyway. Avoid using the root DNS servers at all costs. Hope that helps Regards Malcolm Burtt Touchstone People, Partnerships, Solutions _ From: development-axapta@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sujkowski Sent: 07 March 2006 18:35 To: development-axapta@yahoogroups.com Subject: [development-axapta] SysMailer class Hi everyone, I copied the send email example code from SysMailer help file and put it in a job. It goes like this: SysMailer mailer = new SysMailer(); mailer.body(This is the body of the mail); mailer.subject(Eureka! Axapta generated and email); mailer.fromAddress([EMAIL PROTECTED]); mailer.fromName(Joe Smith); mailer.tos().add([EMAIL PROTECTED]); //mailer.attachments().add(c:\\gylle.log); mailer.sendMail(); print 'done'; pause; The job executes fine but it is extremly slow. At least 15-20 seconds for an email with a single
RE: [development-axapta] SysMailer class
Den 7. marts 2006 19:35 skrev Martin Sujkowski: SysMailer mailer = new SysMailer(); mailer.body(This is the body of the mail); mailer.subject(Eureka! Axapta generated and email); mailer.fromAddress([EMAIL PROTECTED]); mailer.fromName(Joe Smith); mailer.tos().add([EMAIL PROTECTED]); //mailer.attachments().add(c:\\gylle.log); Add: mailer.SMTPRelayServers().add(...) and have it relay through your internal SMTP server Hilsen Søren SPONSORED LINKS Computer part Programming languages Microsoft axapta Support exchange YAHOO! GROUPS LINKS Visit your group "development-axapta" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.