MileFaker3000 Posted February 19, 2018 Posted February 19, 2018 We have been using the email plugin for about a month or so and sometimes it's quite slow. I'm wondering if it's my setup. Here's a basic example of how we'd send a single email. EmailRegister [...] EmailConnectSMTP [...] EmailConnectIMAP [...] EmailCreate [From:FieldA; To:FieldB; Subject:"Text "& FieldC";] EmailSetBodyFile [url:"file:///H:/...template.html"] EmailBodySubstitute [Search String: %%FirstName%%; Replace String: FieldD] EmailBodySubstitute [Search String: %%LastName%%; Replace String: FieldE] EmailBodySubstitute [Search String: %%Salutation%%; Replace String: FieldF] ...etc (usually 8-15 of these) EmailSend EmailMoveCurrentMessage [Folder:"Sent Items"] EmailDisconnect I also have a batch version that adds a loop that seems to be even slower (per email). Am I doing something incorrectly? Are there certain elements of the plugin that run particularly slow (i.e. EmailBodySubstitute or EmailMoveCurrentMessage)? Is it the email server? Or just email in general. An example of speed: I was just told it took 4 minutes to send 10 emails (via the batch script). Typically individual emails are somewhere between 5 seconds and 30 seconds a piece.
ryan360Works Posted February 20, 2018 Posted February 20, 2018 I suspect the delay you are experiencing is coming from EmailConnectSMTP and EmailConnectIMAP because these functions are dependent on a network. Make sure you are not calling EmailConnectSMTP and EmailConnectIMAP in the loop for your batch script because it will definitely slow the script down and could also potentially cause the mail server to deny your connection requests due to too many connection requests in a short period of time. I recommend using the function EmailOutboundIsConnected (and EmailInboundIsConnected to check and see if there is a current connection and if not then call the connect functions. EmailOutboundIsConnected (and EmailInboundIsConnected will return 1 if there is and 0 if there is not. If making those changes don't improve the speed, the progress bar on send may be causing an issue. You can turn it off by passing in the parameter "progress=false" into the EmailSend function.
OlgerDiekstra Posted February 21, 2018 Posted February 21, 2018 Something else to check is the the DNS server (if you're using FQDN). Use an IP address instead to see if that makes a difference. If it does, there's likely an issue with the DNS server. Then there are a lot of things that could cause slowness on the network. Bad cabling, retransmissions, incorrect network card settings, etc.
MileFaker3000 Posted February 21, 2018 Author Posted February 21, 2018 (edited) 19 hours ago, ryan360Works said: I suspect the delay you are experiencing is coming from EmailConnectSMTP and EmailConnectIMAP because these functions are dependent on a network. Make sure you are not calling EmailConnectSMTP and EmailConnectIMAP in the loop for your batch script because it will definitely slow the script down and could also potentially cause the mail server to deny your connection requests due to too many connection requests in a short period of time. I recommend using the function EmailOutboundIsConnected (and EmailInboundIsConnected to check and see if there is a current connection and if not then call the connect functions. EmailOutboundIsConnected (and EmailInboundIsConnected will return 1 if there is and 0 if there is not. If making those changes don't improve the speed, the progress bar on send may be causing an issue. You can turn it off by passing in the parameter "progress=false" into the EmailSend function. EmailConnectSMTP and EmailConnectIMAP are definitely outside of the loop. EmailOutboundIsConnected: I do not have this in my script (there's no info in the docs about it). Would adding this into the loop speed the process up? Something to the effect of "if EmailOutboundIsConnected = 1 then send, else cancel" ? The emails do send as is so the connection is definitely staying open. Additionally, here's an example of my batch script so we're on the same page: EmailRegister [...] EmailConnectSMTP [...] EmailConnectIMAP [...] EmailCreate [From:FieldA; To:FieldB; Subject:"Text "& FieldC";] Go to Record/Request/Page [First] Loop EmailRecipients [...] EmailSetSubject [...] EmailSetBodyFile [url:"file:///H:/...template.html"] EmailBodySubstitute [Search String: %%FirstName%%; Replace String: FieldD] EmailBodySubstitute [Search String: %%LastName%%; Replace String: FieldE] EmailBodySubstitute [Search String: %%Salutation%%; Replace String: FieldF] ...etc (usually 8-15 of these) EmailSend EmailMoveCurrentMessage [Folder:"Sent Items"] Go to Record/Request/Page [Next; Exit after last: On] End Loop EmailDisconnect Thanks! 6 hours ago, OlgerDiekstra said: Something else to check is the the DNS server (if you're using FQDN). Use an IP address instead to see if that makes a difference. If it does, there's likely an issue with the DNS server. Then there are a lot of things that could cause slowness on the network. Bad cabling, retransmissions, incorrect network card settings, etc. We are using Office365, set up as follows: EmailConnectSMTP [Host: "smtp.office365.com:587"; Username: ...; Password: ...; Secure connection: "Case (0;1;1;1;0)"] EmailConnectSMTP [Host: "outlook.office365.com:993"; Username: ...; Password: ...; Secure connection: "ssl=1"] Maybe the security is not set up correctly? I had to figure that one out with some google-fu. There are no other speed issues on the network, and it's the same on all 3 workstations that currently use the email plugin, so I don't think it's hardware based. Thanks! Edited February 21, 2018 by MileFaker3000
ryan360Works Posted February 21, 2018 Posted February 21, 2018 Everything looks to be correct in your scripts so I still think the delay is in one of the connect functions or caused by the progress bar in the EmailSend function. Have you tried turning off the progress bar? If that doesn't change anything, debug through the script and see if any of the script steps take a significant amount of time to execute. As OlgerDiekstra pointed out, if it happens on the connect functions there is a network issue that is causing the delay. Please update this thread with what you find.
MileFaker3000 Posted February 21, 2018 Author Posted February 21, 2018 5 minutes ago, ryan360Works said: Have you tried turning off the progress bar? According to the docs it should be a setting on the EmailSend function, but I am unable to add any parameters to that function. What am I missing? I'm on Windows if it matters. 7 minutes ago, ryan360Works said: debug through the script and see if any of the script steps take a significant amount of time to execute I am also struggling to figure out the error capture. Shouldn't I be able to just add a step right before EmailDisconnect that is essentially: If Get ( LastError ) = "ERROR" then show custom dialog with EmailLastError as body? Again maybe I'm just missing something.
ryan360Works Posted February 21, 2018 Posted February 21, 2018 1 minute ago, MileFaker3000 said: According to the docs it should be a setting on the EmailSend function, but I am unable to add any parameters to that function. What am I missing? I'm on Windows if it matters. You'lll have to call the function as a calculation instead of a script step in order to pass in that parameter. 2 minutes ago, MileFaker3000 said: I am also struggling to figure out the error capture. Shouldn't I be able to just add a step right before EmailDisconnect that is essentially: If Get ( LastError ) = "ERROR" then show custom dialog with EmailLastError as body? Again maybe I'm just missing something. You're on the right path but with a few tweaks. EmailLastError is only going to work when calling the functions as calculations. Since you are calling the functions as script steps, if there is an error, our plugins will return an error code of 1552 when Get(LastError) is called. You can get the description of the error by calling Get(LastExternalErrorDetail). You should have this check for every function call.
MileFaker3000 Posted September 4, 2018 Author Posted September 4, 2018 On 2/21/2018 at 11:34 AM, ryan360Works said: debug through the script and see if any of the script steps take a significant amount of time to execute. An update: As I was debugging something else, I noticed that the delay is definitely on the EmailConnectSMTP & EmailConnectIMAP functions. EmailConnectSMTP is definitely slower than EmailConnectIMAP though. Everyone here is suggesting network issues, maybe I'm misunderstanding what is meant by that. Are you referring just to network speeds, etc? We are not having any network issues with anything else we are doing. What's a normal delay for the EmailConnectSMTP & EmailConnectIMAP functions? We are seeing ~5-10 seconds. Can someone remind me why I need to use both EmailConnectSMTP & EmailConnectIMAP? Somewhere I was told to use the IMAP for moving to sent folders. Can I just use IMAP instead of connecting to both? If I'm reading the documentation correctly, both have the ability to send. Thanks!
ryan360Works Posted September 4, 2018 Posted September 4, 2018 Quote Are you referring just to network speeds, etc? Yes Quote What's a normal delay for the EmailConnectSMTP & EmailConnectIMAP functions? We are seeing ~5-10 seconds. That doesn't seem like an excessive amount of time especially if there is some kind of network slowdown or if the server is busy and cant respond to your connection request immediately. This is going to vary from server to server. If you try to connect to say, a gmail server, do you see those same delays? Quote Can someone remind me why I need to use both EmailConnectSMTP & EmailConnectIMAP? Somewhere I was told to use the IMAP for moving to sent folders. Can I just use IMAP instead of connecting to both? If I'm reading the documentation correctly, both have the ability to send. SMTP stands for Simple Mail Transfer Protocol and IMAP stands for Internet Message Access Protocol. SMTP is a standardized sending protocol and IMAP is a standardized receiving protocol. You cannot send messages from an IMAP server. The reason you connect to both in regards to the Email plugin is you do not have access to your inbox folders when connected via SMTP. The reason you connect to an IMAP server is because you are moving your current message to your sent folder which is an IMAP folder and only accessible when connected through IMAP. If you did want to move the current message to the sent folder, only connecting to SMTP would be required.
Recommended Posts
This topic is 2272 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now