Difference between revisions of "SENDMAIL()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Function to send mail | Function to send mail | ||
Line 15: | Line 8: | ||
==See Also== | ==See Also== | ||
− | [[CLOSEMAIL()]], [[COUNTMAIL()]], [[DELETEMAIL()]], [[MAILCLOSE()]], [[MAILCOUNT()]], [[MAILDELETE()]], [[MAILERROR()]], [[MAILHEADER()]], [[MAILNODENAME()]], [[MAILOPEN()]], [[MAILREAD()]], [[MAILSEND()]], [[MAILUSERNAME()]], [[OPENMAIL()]], [[READMAIL()]] | + | [[CLOSEMAIL()]], [[COUNTMAIL()]], [[DELETEMAIL()]], [[MAILATTACH()]], [[MAILCLOSE()]], [[MAILCOUNT()]], [[MAILDELETE()]], [[MAILERROR()]], [[MAILHEADER()]], [[MAILNODENAME()]], [[MAILOPEN()]], [[MAILREAD()]], [[MAILSAVEAS()]], [[MAILSEND()]], [[MAILUSERNAME()]], [[OPENMAIL()]], [[READMAIL()]] |
Line 46: | Line 39: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | // Open SMTP | + | // Open SMTP mail connection to the mail server |
m_open = mailopen("mailserver.company.com","username","password","SMTP") | m_open = mailopen("mailserver.company.com","username","password","SMTP") | ||
if not m_open | if not m_open | ||
− | dialog box mailerror() | + | dialog box mailerror() |
− | return | + | return |
endif | endif | ||
+ | // send the mail | ||
fromname = "info@recital.com" | fromname = "info@recital.com" | ||
tonames = "fred@recital.com;sue@recital.com" | tonames = "fred@recital.com;sue@recital.com" | ||
ccnames = "bert@recital.co.uk;linda@recital.co.uk" | ccnames = "bert@recital.co.uk;linda@recital.co.uk" | ||
subject = "For your information" | subject = "For your information" | ||
− | + | msg = "Dear All" + chr(10) + "Here are the files you asked for."; | |
− | "Best regards" + chr(10) + "Sam" | + | + chr(10) + "Best regards" + chr(10) + "Sam" |
attachments = "info.doc, info.xls" | attachments = "info.doc, info.xls" | ||
− | mailsend(fromname,tonames,ccnames,subject, | + | mailsend(fromname, tonames, ccnames, subject, msg, attachments) |
+ | |||
+ | // close the connection to the mail server | ||
mailclose() | mailclose() | ||
− | // Open SMTP | + | // Open SMTP mail connection to the mail server |
− | m_open = mailopen("mailserver.company.com","username","password | + | m_open = mailopen("mailserver.company.com", "username", "password") |
if not m_open | if not m_open | ||
− | dialog box mailerror() | + | dialog box mailerror() |
− | return | + | return |
endif | endif | ||
+ | // sendmail() and mailsend() are functionally identical | ||
fromname = "info@recital.com" | fromname = "info@recital.com" | ||
tonames = "fred@recital.com" | tonames = "fred@recital.com" | ||
ccnames = "" | ccnames = "" | ||
subject = "For your information" | subject = "For your information" | ||
− | + | msg = "email.htm" | |
attachments = "" | attachments = "" | ||
− | content = " | + | content = "text/html" |
− | sendmail(fromname,tonames,ccnames,subject, | + | sendmail(fromname, tonames, ccnames, subject, msg, attachments, .F., content) |
+ | |||
+ | // close the connection to the mail server | ||
mailclose() | mailclose() | ||
</code> | </code> | ||
− | |||
==Products== | ==Products== | ||
− | Recital | + | Recital, Recital Server |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
+ | [[Category:Mail]] | ||
+ | [[Category:Mail Functions]] |
Latest revision as of 13:50, 4 July 2011
Purpose
Function to send mail
Syntax
SENDMAIL([<expC1>],<expC2>, [<expC3>], [<expC4>], <expC5> [,<expC6> [, <expL1>]] [,<expC7>])
See Also
CLOSEMAIL(), COUNTMAIL(), DELETEMAIL(), MAILATTACH(), MAILCLOSE(), MAILCOUNT(), MAILDELETE(), MAILERROR(), MAILHEADER(), MAILNODENAME(), MAILOPEN(), MAILREAD(), MAILSAVEAS(), MAILSEND(), MAILUSERNAME(), OPENMAIL(), READMAIL()
Description
The SENDMAIL() function is used for sending mail. If successful the SENDMAIL() will return .T. or .F. otherwise. The MAILERROR() function can be used to return the error message if the SENDMAIL() fails.
Parameters | Required | Default | Description |
---|---|---|---|
<expC1> | No | Your node | The from name of the sender |
<expC2> | Yes | None | A semi-colon separated list of recipient names to receive the message |
<expC3> | Yes | None | A semi-colon separated list of cc recipient names to receive the message |
<expC4> | No | None | The subject of the message |
<expC5> | Yes | None | The message to be sent. This can be a character string, a variable containing a character string or a character string containing the name of a text file. |
<expC6> | No | None | A comma separated list of names of files to be sent as attachments |
<expL1> | No | None | Open VMS only. If <expL1> is .T. (true), any attachments will be sent as ASCII, not binary. If <expL1> is .F. or omitted, all attachments will be sent as binary 64 bit encoded. |
<expC7> | No | text/plain | Content type |
Example
// Open SMTP mail connection to the mail server m_open = mailopen("mailserver.company.com","username","password","SMTP") if not m_open dialog box mailerror() return endif // send the mail fromname = "info@recital.com" tonames = "fred@recital.com;sue@recital.com" ccnames = "bert@recital.co.uk;linda@recital.co.uk" subject = "For your information" msg = "Dear All" + chr(10) + "Here are the files you asked for."; + chr(10) + "Best regards" + chr(10) + "Sam" attachments = "info.doc, info.xls" mailsend(fromname, tonames, ccnames, subject, msg, attachments) // close the connection to the mail server mailclose() // Open SMTP mail connection to the mail server m_open = mailopen("mailserver.company.com", "username", "password") if not m_open dialog box mailerror() return endif // sendmail() and mailsend() are functionally identical fromname = "info@recital.com" tonames = "fred@recital.com" ccnames = "" subject = "For your information" msg = "email.htm" attachments = "" content = "text/html" sendmail(fromname, tonames, ccnames, subject, msg, attachments, .F., content) // close the connection to the mail server mailclose()
Products
Recital, Recital Server