1 mail
to='smtphost'
smtphost='smtphost'
from='from'
cc='cc'
bcc='bcc'
subject='subject'
encoding='encoding'
addReadReceiptHeader='true|false'
addDeliveryReceiptHeader='true|false'
user='user'
password='password'
port='port'
timeout='timeout'
localhost='localhost'
localaddress='localaddress'
localport='localport'
auth='auth'
submiter='submiter'
dsn.notify='dsn.notify'
dsn.ret='FULL|HDRS'
allow8bitmime='true|false'
sendpartial='true|false'
quitwait='true|false'
reportsuccess='true|false'
socketFactory.class='socketFactory.class'
socketFactory.fallback='true|false'
socketFactory.port='socketFactory.port'
starttls.enable='true|false'
usereset='true|false'
proxySet='proxySet'
socksProxyHost='socksProxyHost'
socksProxyPort='socksProxyPort'
socksProxyPort='socksProxyPort'
>
<content type='text/html'> *
<cdata /> +
</content>
<attachs> *
<mail.attach
type='type'
name='name'
zip='true|false'
> *
<file /> !
</mail.attach>
<array> ?
<mail.attach
type='type'
zip='zip'
> *
<file /> !
</mail.attach>
</array>
</attachs>
</mail>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Ato | string | Destination email address. | |||
Asmtphost | string | Domain name of the server of outgoing email. | |||
Afrom | string | Email address source (sender). | |||
Acc | string | Destination email address with copy. | |||
Abcc | string | Destination email address with hidden copy. | |||
Asubject | string | Description of the message. | |||
Aencoding | string | Text coding. | |||
AaddReadReceiptHeader | boolean | Reading notification. Request reading notification. | |||
AaddDeliveryReceiptHeader | boolean | Delivery notification. Request delivery notification. | |||
Auser | string | Username of connection to the SMTP server. | |||
Apassword | string | Password of the user connecting to the SMTP server. | |||
Aport | integer | Port in which the server SMTP is connected. | |||
Atimeout | integer | Timeout of the Socket I/O en milliseconds. | |||
Alocalhost | string | Name of the localhost used in the command HELO or in the EHLO comand in the SMTP. | |||
Alocaladdress | string | Local address (host name) with the socket SMTP is created. | |||
Alocalport | string | Local port number with which the SMTP socket is created. | |||
Aauth | boolean | false | If true, authenticate the user through the AUTH command. | ||
Asubmiter | string | Name of the sender of the mail used in the AUTH tag. | |||
Adsn.notify | string | Option NOTIFY in the RCPT command. It can be NEVER, or some combination of SUCCESS, FAILURE, and DELAY (separated by commas). | |||
Adsn.ret | string | Option RET of the command MAIL. | |||
Aallow8bitmime | boolean | If true and the server admits the extension 8BITMIME, the text parts which use the encodings "quoted-printable" or "base64" are converted to encoding "8bit", as long as they follow RFC2045 rules for 8bit text. | |||
Asendpartial | boolean | false | If true, the mail will be sent partially even if it contains invalid addresses, reporting the partial fail with SendFailedException. If false, none of the recipients will be sent the mail. | ||
Aquitwait | boolean | true | If false, the connection is closed inmediately. If true, the transport wait the response of the QUIT command. | ||
Areportsuccess | boolean | true | If true, the transport will include a SMTPAddressSucceededException for each one of the addresses to which the mail has been successfully sent. | ||
AsocketFactory.class | string | Class used to create the sockets STMP. | |||
AsocketFactory.fallback | boolean | true | If true, when a socket with the specified class can not be created, a socket with the class 'java.net.Socket' will be created. | ||
AsocketFactory.port | integer | Specifies the port to connect to when it has been reported "SocketFactory.class". If not informed, it will use the default port. | |||
Astarttls.enable | boolean | false | If true, habilitates the use of the STARTTLS command (always that the server admit it) to change the connection to a protected connection before issuing any login command. | ||
Ausereset | boolean | false | If true, use the RSET command instead of the NOOP command in the function isConnected. | ||
AproxySet | string | Specify the proxy to use. | |||
AsocksProxyHost | string | Indicates the name of the server proxy SOCKS which will be used by the protocol el protocol SOCKS. | |||
AsocksProxyPort | integer | Indicate the port number that will be used by the SOCKS protocol. | |||
AsocksProxyPort | integer | Indicate the port number that will be used by SOCKS protocol. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Econtent | Body of the email which contains the message. | ||||
Atype | string | Indicate if the content of the text contains HTML tags. | |||
Ecdata | XML CDATA | ||||
Eattachs | Includes the file to attach. | ||||
Email.attach | XML CDATA | Includes the file to attach. | |||
Atype | string |
Data type which contains the attached file (mime type):
|
|||
Aname | string | Name of the attached file. | |||
Azip | boolean | Indicate if this entry is compressed. | |||
Efile | file | ||||
Earray | array | An array which contains multiple elements mail.attach. This allows that the number of arrays to include in the email be varianle because a loop can be performed and adding in the array in function of the needs. | |||
Email.attach | Includes the file to attach. | ||||
Atype | string | Type of file (mimetype). | |||
Azip | boolean | ||||
Efile | file |
Returns | |
---|---|
Type | Description |
boolean | Returns true if the email has been sent. |
Exceptions
must specify from attribute or log as user
It has not been specified the sender through the attribute from and the system is not able to obtain a sender through the username of the session.
must specify smtphost attribute or setup one for group
Send an email message.
<xsql-script name='mail_sample1'> <body> <mail smtphost='mail.deister.net' from='sender@deister.es' to='receiver@deister.es' subject='Test 1' > <content> Email sent through Axional Studio XSQL-Script. </content> </mail> </body> </xsql-script>
Sending a message using the smtphost attribute to indicate a certain email client.
2 Attached content
You can attach content to a email through the tag mail.attach
<xsql-script name='mail_sample2'> <body> <mail smtphost='mail.deister.net' from='pcasellas@deister.es' to='pcc' subject='Test 2' > <content> Email with attached file sent through Axional Studio XSQL-Script. </content> <attachs> <mail.attach type='image/jpeg'> <file name='/path/snowfall.jpg' type='absolute' /> </mail.attach> </attachs> </mail> </body> </xsql-script>
Send a email with an array of attached files.
<xsql-script name='send_mail'> <body> <array name='arr' /> <array.add name='arr'> <mail.attach type='image/jpeg'><file type='absolute' name='tanque.jpg' /></mail.attach> <mail.attach type='application/ms-word'><file type='absolute' name='test.doc' zip='true'/></mail.attach> </array.add> <mail smtphost='mail.deister.net' from='dani@deister.es' to='dani@deister.es' subject='test' file-encoding='iso-8859-1' encoding='iso-8859-1' > <content type='text/plain'> Sending email with several attached files obtained from an array. </content> <attachs> <arr /> </attachs> </mail> </body> </xsql-script>
Sending of a email with inline images.
<xsql-script name='test_mail_inline_images'> <body> <mail smtphost='192.168.10.9' from='info@noserver.org' to='no-reply@gmail.com' subject='test_mail_inline_images' > <content type='text/html'> Begin of the text <div><IMG SRC='cid:my_custom_mail_part_id_1' STYLE='width:200px;height:200px;'></div> More text <div><IMG SRC='cid:my_custom_mail_part_id_2' STYLE='width:200px;height:200px;'></div> End of the text </content> <attachs> <mail.attach type='image/gif' cid='my_custom_mail_part_id_1'> <file name='c:\temp\img1.png' type='absolute' /> </mail.attach> <mail.attach type='image/gif' cid='my_custom_mail_part_id_2'> <file name='c:\temp\img2.png' type='absolute' /> </mail.attach> </attachs> </mail> </body> </xsql-script>
3 Sending of SMS using email
<mail> offers the possibility to send SMS messages (Short Message Service) to mobile devices.
For this, it is necessary to perform the following settings:
- Specify the telephone number in the field user_sms_phone of the table wic_user, for each one of the receivers of text messages.
- Indicate the email address for sending SMS, in the column group_sms_address of the table wic_user_groups, for each user group to which the target persons belong.
To be able to send SMS messages, the label <mail> should be used as an email, unically it should be informed as value of
attribute to (destination email), the result of concatenate the telephone number of the receiving user, with the email
of the group of the users to which belongs.
The service consist in a Linux gateway which when receive a email for a receiver of the type 34647474747<sms@empresa.com>,
uses the telephone number to send the content of the same (only the first characters).
Send a SMS text message.
<xsql-script name='mail_sample3'> <args> <arg name='p_usercode' type='string' /> </args> <body> <if> <expr> <system.user.hasSMSEnabled code='#p_usercode' /> </expr> <then> <set name='m_to'> <string trim='true'> <system.user.getSMSPhone code='#p_usercode' /> <system.user.getSMSAddress code='#p_usercode' /> </string> </set> <mail to='#m_to' subject='test'> <content type='text/plain'>test SMS</content> </mail> <println>SMS sent to <m_to/></println> </then> <else> <println>SMS sending service not configured</println> </else> </if> </body> </xsql-script>
The function <system.user.hasSMSEnabled> returns the value true if the username specified in the attribute code, have set the phone number and the user group to which belong, dispose of an email to send SMS.
Thorugh <system.user.getSMSPhone> and <system.user.getSMSAddress> is obtained respectively, the phone number of the user and the email address of the group to he belongs.
The result of the execution shown by console, would be the followed:
SMS send to 34659539727<sms@deister.net>