Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Smtp Client Question

Question:

I have searched the EZ-Script manual for SMTP Client, No success.
I have searched the page from which the client is download from: No success.
If there is help about this I do apologize in advance.

The code works. I can email myself, what I would like to do is email other people.
What is the syntax?

Thanks
WayneA.

AI Support Bot
Related Content
Synthiam
#1  

Quote:


I have searched the EZ-Script manual for SMTP Client, No success.

Plugins are not documented in the manual because they are not all written by EZ-Robot.

I found documentation/example on the plugin details page.
https://synthiam.com/redirect/legacy?table=plugin&id=128

For sending a text email, the code is

[code]
ControlCommand("SMTP Client", Send, "user@gmail.com";, "Mr Recipient", "This is the subject", "This is a test message")
[code]

Some additional information not on the page:

"user@gmail.com"; would be the recipient email address.
"Mr Recipient" would be the recipient name.
"This is the subject" would be the subject.
"This is a test message" would be the body of the email.

Any of these could be or contain variables instead of hard coded text in your script.

You can see how to attach an image from the camera in the example on the page.

Alan
#2  
Updated Question for this thread:

What is syntax to add another line in the message body.

For example:
This is a test message 1
This is a test message 2

Thanks in advance,
Wayne
PRO
USA
#3  
@WayneA

There are some string limitations, you need to think out of the box.

Try this:
Create a file called crlf.txt and press enter then save the file.

ez-script:

Code:



#update the variable to reflect the above file location:
$crlf_filename = "C:\Users\ptp\Desktop\crlf.txt"
$crlf=FileReadAll($crlf_filename)
FileReadClose($crlf_filename)

$message="This is a test:" + $crlf + "Line 1" + $crlf + "Line 2" + $crlf + "Line 3"

ControlCommand("SMTP Client", Send, "JohnDoe AT anonymous.com", "John Doe", "mail subject", $message)
PRO
Synthiam
#4  
Or

Code:


ControlCommand("SMTP Client", Send, "JohnDoe AT anonymous.com", "John Doe", "mail subject", "This is a line\r\nThis is a new line")
#5  
Thanks both for the responses. I will try to use.
PRO
USA
#6  
@DJ

yours is an in-box-solution:)

I missed that improvement i.e. encoding chars are there more than \r \n ?
#7  
@DJ The code you posted did not work. I got the following.

This is a Test\r\nThis is a test 2

The above was in the body of the email. Should I try a different method?
PRO
USA
#8  
@WayneA,

Did you tried my version ?
#11  
@ptp Yes sir, I tried to use but it seemed way over my head.

Never fear I will keep trying to use.
PRO
Synthiam
#12  
Upgrade to the latest plugin and use this:

Code:


ControlCommand("SMTP Client", Send, "JohnDoe AT somewhere.com", "John Doe", "mail subject", "This is a line\r\nThis is a new line")
#13  
@DJ Thank You very much. Hope I did not cause to much trouble.
#14  
Another question regarding format.

Is the new code added to the plugin able to handle string formatting. For example:

Code:



ControlCommand("SMTP Client", Send, "JohnDoe AT somewhere.com", "John Doe", "mail subject", "$sting1\r\n$string2")



With quotation marks, the email body simply displays the $string1\r\n$string2

If I do not use the quotation marks, nothing happens.

Is the plug in not supposed to handle string variables.

Thanks!
WayneA
PRO
USA
#15  
@WayneA:

string concatenation operation is not the same as handling special chars inside a string.

Try this:

Code:


ControlCommand("SMTP Client", Send, "JohnDoe AT somewhere.com", "John Doe", "mail subject", $string1 + "\r\n" + $string2)
#16  
@ptp

That did not work. Thanks for you help.
PRO
USA
#17  
same result ?