EQMail.inc (Send e-mail through EQ)

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

EQMail.inc (Send e-mail through EQ)

Post by Glasscoin » Sun Mar 14, 2004 6:12 pm

Here's a little *.inc I've been using in some of my macros, as of late...
I know that e-mail support is something that's probably best done through a plugin, and I toyed around with the problem a bit before realizing that I absolutely suck at C++.

There was a solution, though I'll be the first to admit it wasn't the best way of doing things... building on HaCK's excellent mob-checker with e-mail support, I made a simple lil' program that will read settings from an *.ini file and e-mail 'em. This allows you to set custom e-mail messages on the fly.

EQMail.inc

Code: Select all

| EQMail.inc

Sub EQMail
   /if @Param0=="" {
      /echo Usage:  /call eqmail <from> <e-mail address> <subject> <message>
   } else {
      /ini "eqmail.ini" "Main" "FromName" "@Param0"
      /ini "eqmail.ini" "Main" "ToEmailAddress" "@Param1"
      /ini "eqmail.ini" "Main" "EmailSubject" "@Param2"
      /ini "eqmail.ini" "Main" "EmailBodyOfMessage" "@Param3"
      /exec "$ini(eqmail.ini,Main,AppPath)" bg
   }
/return 
EQMail.ini

Code: Select all

[Main]
AppPath=C:\Macros\EQMail.exe
MailServerName=mx1.hotmail.com
FromName=Spawn Checker
FromEmailAddress=spawn@macroquest2.com
ToName=me@wherever.com
ToEmailAddress=me@wherever.com
EmailSubject=Blah has spawned.
EmailBodyOfMessage=Skip off work and come kill me.
Please note: You will require the program EQMail to include this routine, which is downloadable here. If there's enough interest, I'll also post the source, but it's really just an app that uses Winsock to telnet to the SMTP server and send the values written to the EQMail.ini file. Make sure to update the *.ini to reflect both the directory where you've placed the EQMail program and the SMTP server you use to send e-mail!

Here's a bit of sample code, using eqmail.inc.

Code: Select all

#include eqmail.inc

Sub Main 
/declare alertlistno_ global 
/declare spawn_name global 
/varset alertlistno_ 9 
/varset spawn_name "@Param0" 
    
   /alert clear alertlistno_ 
   /alert add alertlistno_ npc radius 10000 "@spawn_name" 
      
    :TOP 
   /if $alert(alertlistno_)==TRUE { 
      /call EQMail "@spawn_name" "youremail@wherever.com" "I've spawned!" "Come kill me."
      /return 
   } else { 
      /goto :TOP 
   } 
/return 
Let's say you ran this code, specifying Stormfeather as your target. When he spawned, you'd recieve an e-mail with the author as Stormfeather, subject saying, "I've spawned," and e-mail body as "Come kill me." There are a lot of possibilties... I personally use it so I can get spawn notifications on my cell phone.

A quick note: if you wanted more functionality, you could use the /ini command to change the other settings in the *.ini file, such as the SMTP server, the e-mail address from which the e-mail would appear to originate, the name the e-mail was being sent to, etc. All of these values are reloaded whenever EQMail.exe is executed.

Micro
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Mar 12, 2004 5:56 pm

Post by Micro » Mon Mar 15, 2004 10:53 am

If its all the same to you, I'd just asume see all the source code and not run some untrusted binary.

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Post by Glasscoin » Mon Mar 15, 2004 11:15 am

Of course. I can certainly both understand and appreciate your concern.
Source code can be downloaded here.

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Post by Lane » Mon Mar 15, 2004 12:42 pm

Doh.. No source for me.


The daily bandwidth limit for this customer has been exceeded. Try again after midnight, EST.
Click here for more information.

-Lane

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Bah!

Post by Glasscoin » Mon Mar 15, 2004 1:21 pm

D'oh. Sadly, I lack anywhere else that I could upload the source -- you could try back later, or just send me a PM and I can e-mail you the source.

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Fri Apr 02, 2004 11:38 pm

Post the source here...

or PM me the source. I'll host it.

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Mon Apr 12, 2004 9:47 pm

Ok, I zipped the source and the ini file. I didn't include the .exe since you should recompile this your self.

http://www.geocities.com/mq2eqmail/eqmail.zip

You can retrieve it there.

Might have to cut and paste the link I'm not sure.

mcswanbeck
a lesser mummy
a lesser mummy
Posts: 70
Joined: Fri Jan 16, 2004 5:16 am

Post by mcswanbeck » Tue Apr 13, 2004 3:58 am

Broken link?
/mcswanbeck

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Tue Apr 13, 2004 8:36 am

No it isn't broken. Copy and paste the link and it works. Geocities doesn't allow directlinking to cut down on warez and such I suppose...