I didn't see a clear example so i wrote a "email post office script"
integer testMode;
string nameData;
key tempKey;
key nameQueryKey;
string eMsg;
string eAddress;
default{
state_entry() {
llSay(0, "Send email to: " + (string)llGetKey() + "@lsl.secondlife.com with UUID of avatar in the subject line");
llSetTimerEvent(5.0);
}
email(string time, string address, string subject, string msg, integer num_left) {
if (llGetSubString(address, -19, -1) == "@lsl.secondlife.com") msg = llDeleteSubString(msg, 0, llSubStringIndex(msg, "\n\n") + 1);
if (llGetSubString(subject,14,14)=="4" && llStringLength(subject)==36) { // it's UUID but is avatar???
eMsg = msg;
eAddress = address;
testMode = 1; // We will test the validy of the UUID given
nameData = ""; // set to nothing.. and see if i can raise a dataserver name request
tempKey = (key)subject;
nameQueryKey = llRequestDisplayName((key)subject); // the only way to test valid Avatar UUID
llSleep(3.0);
}
if(num_left) llGetNextEmail("", "");
}
dataserver(key queryid, string data) {if (nameQueryKey == queryid ) nameData = data;}
timer() {
llGetNextEmail("", "");
if (testMode) { // Check the contents of nameData to see if UUID was valid
if (nameData) llRegionSayTo(tempKey,0,"Email from " + eAddress + "\n" + eMsg);
else llEmail(eAddress, "Avatar not found", "Your message to " + (string)tempKey + " failed.");
testMode = 0;
}
}
}