email(string time, string address, string subj, string message, integer num_left)
Triggered when a request by
llGetNextEmail is answered.
Returned are the email's
time, sender's
address, subject in
subj, the
message itself and how many more emails are
queued for this
object in
num_left.
time is a UNIX
timestamp (
integer) typecast as a string, similar to that returned by
llGetUNIXTime.
address and
subj are limited to 78
characters each.
message is limited to 1000 characters. (4KByte, not 1000 byte)
The
message field is formatted as follows:
Object-Name: object_name\n
Region: region_name (region_corner _coordinates)\n
Local-Position: (local_pos)\n
\n
message_text
Where:
object_name is the name of the sending object. To get the objects key, look at the sender's address.
region_name is the name of sim the object is located in. This is as returned by
llGetRegionName.
region_corner_coordinates is the region's
Region Corner. This is in the format x,y with no z component. t is not enclosed in <>'s.
local_pos is the sending object's local position. It is in the format x,y,z . It is not enclosed in <>'s.
message_text is the actual text sent in the message string in
llEmail.
To remove the headers attached to the beginning of the message, use this line:
Notes:
- Emails outside these limits will not bounce, but are silently discarded instead.
- Incoming emails are stripped of quoted text ("> bla"), any control characters and sigdashes ("-- \n"), as well as anything below them.
- As of SL 1.5.8, llGetNextEmail now invokes no sleep penalty. Note: the rate at which emails can be downloaded is limited by the period between a successful llGetNextEmail call and the corresponding email event (from 1 to 3 seconds). There is no reason to poll faster than that, but there is no penalty if you do. For best results, call llGetNextEmail at some descheduled rate (every 5 seconds or longer), then call llGetNextEmail again at the end of the the email event if (and only if) there are more pending emails in the queue.
- Don't think subject limit is true anymore. I've sent 120 characters on my last test -MaxCase
- As of SL 1.6.6, the number of pending emails is 100 and bounce messages are received when a queue is full. -Splat1Edison
- As of SL 1.6.10, if sent from external sources, the subject bounces at >78 characters and message at >1000 characters -AlondriaLeFay
- Seems the statement about subj outbound character limitations needs to be investigated more before being stated so concisely. I passed up to 110 characters so far, each character over 78 taking slightly longer to be delivered. This concurs with -MaxCase's findings above. Version: SL 1.8.2 (7) Jan. 30, 2006 -SiRiSAsturias
- As of SL 1.10.3 (4), the message limit of 1000 characters may have been relaxed? I was able to pass approx. 1100 characters from SL to an external email address. -BurnmanBedlam (this is incoming mail, not outgoing, which has a limit of 4096 characters for all parts)
Example:
default {
state_entry() {
llEmail((string)llGetKey() + "@lsl.secondlife.com", "Test!", "This is a test message."); // Send email to self.
llSetTimerEvent(2.5); // Poll for emails. (Yes, that is a retarded way on an event-based system!)
}
timer() {
llGetNextEmail("", ""); // Check for email with any sender address and subject.
}
email(string time, string address, string subj, string message, integer num_left) {
llSay(0, "You got mail! " + (string)num_left + " more mails.");
llSay(0, llList2CSV([time, address, subj, message]));
if (num_left == 0) llSetTimerEvent(0.0); // Stop timer when there's no more email.
}
}
To
send an email, use
llEmail.
Events |
Communications