[MUD-Dev] Mail from mud

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Wed Dec 31 20:22:02 CET 1997


[Zoran:]

[Sorry, my editor chopped your long lines...]

:Heyas...gonna ask for a little technical info here.  I would like to have my c
:player, using a stored email address, but I'm not too sure how to go about con
:Anyone done this, or something similar?  I was thinking of somehow writing a f
:from the mud queueing the mail for delivery, but I really am not sure how to d

I have optional stuff in my scenario to do that, and also reading and
posting to newsgroups. However, it relies on the hosting system having
a certain setup, with standard programs for sending mail and posting
news. In my Amiga setup (fairly similar to what UNIX systems use), all
of the needed stuff is actually specified on the command line to the
'sendmail' command.

Keeping in mind that this is AmigaMUD source code, and that the system
commands are Amiga specific, here is the code for the final send, taken
right out of my sources:

define tp_email proc emailSendLetter(string s)void:
    int fd;
    string cmd;
    thing me;

    me := Me();
    if s = "" then
	Print("Empty letter - not sent.\n");
    else
	/* note: server runs atomically, so no conflict over the temp file */
	fd := FileOpenForWrite("T:MUD.letter");
	if fd = 0 then
	    Print("Sorry - can't open letter file.\n");
	else
	    Log("'" + me at p_pName + "' mailing to " + me at p_pEmailTo + "\n");
	    FileWrite(fd, "X-MailSoftware: AmigaMUD telegram office\n");
	    FileWrite(fd, "\n");
	    FileWrite(fd, s);
	    FileClose(fd);
	    cmd := "sendmail < T:MUD.letter -f \"" + me at p_pName +
		"\" -t " + me at p_pEmailTo;
	    if me at p_pEmailSubject ~= "" then
		cmd := cmd + " -s \"" + me at p_pEmailSubject + "\"";
	    fi;
	    cmd := cmd + " -R \"" + me at p_pNRealName + "\"";
	    Execute(cmd);
	    Execute("delete T:MUD.letter");
	    /* do this so that local mail, as in name at here, will work */
	    if NewsThing at p_pRunUUXQT then
		Execute("uuxqt");
	    fi;
	fi;
    fi;
    me -- p_pEmailTo;
    me -- p_pEmailSubject;
corp;


--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the mud-dev-archive mailing list