A pointer variable containing the message.
The sender's email address.
The sender's name.
A semi-colon (;), comma (,), or CR-LF delimited list of recipients. Microsoft Outlook allows you to format the address as "recipient_name<[email protected]>". This hides the "<[email protected]>" portion of the field from the recipient.
The CC list. Multiple entries are separated by commas.
The BCC list. Multiple entries are separated by commas.
The subject line of the email. Optional, depending on mail server requirements.
The body of a text message. Optional, depending on mail server requirements.
The body of a HTML message.
A semi-colon (;), comma, or CR-LF delimited list of filenames. Any file type can be attached.
Default = NULL. The sending email program.
Default = .F. .T. = Attachments are embedded image in the HTML message. .F. = Attachments are separate files.
Default = "". The date of the email.
Default = "". A list of failed addresses.
Default = "". Optional email headers. Email headers are specified as a CR-LF delimited list of colon separated name-value pairs. Headers can be one of the standard mail headers or a user-defined header. Prefix user-defined headers with "X-".
dim headers as c =<<%str% Reply-To: [email protected] X-company: Example Co X-campaign: Spring Launch %str%
See RFC 822 to learn more about message headers.The support of an email header is dependent on the email client. Some email clients may not support the header(s) you include in the message.
Default = "". A list of successful addresses.
Default = .F. If .t. then an e-mail will be sent to the sender acknowledging that the recipient has read the e-mail. Note that not all e-mail clients support this feature and the recipient might decline to send the receipt.
Uses the last active profile. The name of an email profile as found on the View > Settings > Email > Profiles tab.
Default = .F. Allows you to trap errors using the Xbasic ON ERROR GOTO command. .T. = Error trapping on. .F. = Error trapping off.
Desktop Applications Only. Whether to store the message in your mailbox. .T. = Alpha Anywhere stores a copy of the message in a DBF table. .F. = Copy not saved.
Default = .T. Whether to force text emails to wrap at 72 characters per line. .T. = Automatically wrap all lines of text at 72 characters or less. .F. = Leave text email body unchanged.
Indicates success or failure after sending an email. If Result_Flag is .F., the email was not sent. If .T., the email was sent.
Send an email message
EMAIL_SEND2() sends an email message using Alpha Anywhere's built-in email features. The function does not require that you have a third party email client (such as Eudora or Outlook ) installed on the computer.
Sends an email message using Alpha Anywhere's internal email facility. A copy of the message is stored in the user's Alpha Anywhere outbox, a DBF table.
dim message as P body = <<%a% Just wanted to let you know that we really enjoy using Alpha Anywhere. %a% message.message = body message.to = "[email protected]" message.subject = "Thanks" email_send2(message, "", .F., .T.)
The store_in_mailbox argument is not supported in web applications.
The Silent option is useful for Xbasic programmers who are using the EMAIL_SEND2() function in a loop where they want to prevent the standard Alpha Anywhere error messages from popping up when an error (such as a bad email address) in encountered. Instead, they want to write their own error handler for this condition. For example:
Dim tbl as P Dim ITbl as P Tbl = table.open("customers") Query.filter = "balance > 1000000" Query.order = "recno() " ITbl = tbl.query_create() Tbl.fetch_first() While .not. tbl.fetch_eof() ON ERROR GOTO BAD_EMAIL
Fill in all of the arguments for EMAIL_SEND2() and set the Silent parameter to .T. .
Email_send2(message, profile, .t.) ON ERROR GOTO 0 'turn error handler off Tbl.fetch_next() End While Tbl.close() ' end the main script here so that it does not continue into the error handler End BAD_EMAIL: ' put you own error handling code here RESUME NEXT ' causes Alpha Anywhere to resume on the line after email_sends() end
This example shows how to include an image in an email. Note that pm.lrelated is set to .T.. This allows the image attached to the email to be referenced in the email body.
dim pm as p pm.attachments = "C:\login.jpg" pm.lrelated = .T. pm.from = "[email protected]" pm.from_alias = "Aaron Brown" pm.to = "[email protected]" pm.subject = "Inline Attachments" pm.html_message = <<%html% <html> <head> </head> <body> This is a message with an <img src="login.jpg" /><br> inline image. </body> </html> %html% email_send2(pm)
Desktop Applications Only