Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts Goto page 1, 2  Next
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Wed Mar 09, 2005 11:58 pm   

Send e-mail from Zmud without an e-mail client
 
With this script you can send an e-mail without using an e-mail client.
The SendMessage alias can take up to four parameters
1) The E-mail Address you're sending the message to
2) The Subject of the message
3) The Text to be sent
4) a list of files to be attached.

Only the E-mail address param is necessary, however if each member of the list of files to be attached doesn't point to a valid file, an error will be raised and the message will not be sent.

Configuration:
The following variables need to be configured correctly in order for the alias to work properly.
1)SmtpServer this should contain the IP Address or the FQDN of your smtp server.
2)SmtpServerPort the port that your smtp server listens on.
3)DefaultFrom should either have your e-mail address or
the name that you want seen in the from field. in single quotes followed by 1 or more spaces followed by your e-mail address.
4)Authenticate if Authenticate evaluates to true the CDO object will attempt to authenticate using the SendUserName and SendPassword.
5)SendUserName if authenticating the account name required to logon to the smtp server.
6)SendPassword the password required to logon to the smtp server.


Requirements:
CDO Library Requires at least one of these
Windows 2000/XP,
Exchange Server 5.5 SP1 or better,
Outlook 98 or better
Outlook Express (I'm actually not sure if OE installs CDO).

ADO
If you're using Zmud then you already have ADO installed.



Code:
#CLASS {CDOEmail}
#ALIAS SendMessage {#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {#Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value @SendUsername
#Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value @SendPassword}
#call @MsgObj.Configuration.Fields.Update
#Var MsgObj.To {%1}
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {%2}
#Var MsgObj.TextBody {%3}
#loop %numitems({%4}) {#Call @MsgObj.AddAttachment(%item({%4},%i))}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
}
#VAR ConfObj {}
#VAR MsgObj {}
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.mail.fictionaladdress.ca}
#VAR SmtpServerPort {25}
#VAR Authenticate {1}
#VAR SendUsername {Figment}
#VAR SendPassword {madeup}
#VAR DefaultFrom {'Dharkael' Figment@FictionalAddress.ca}
#CLASS 0


Here are a few links to find out more about CDO

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_iconfiguration_interface.asp?frame=true
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp?frame=true

//Uses Default Outlook Express Settings
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration.asp


p.s. if there are any errors, when it attempts to send, such as the server is too busy, it will throw an error and your message will not be sent.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
geengyr
Newbie


Joined: 05 Sep 2004
Posts: 6

PostPosted: Sun Apr 17, 2005 3:06 pm   
 
After setting the vars, doing sendmessage test@yahoo.ca test test

I get the message:

Error parsing command:
Insufficient permissions prevents writing to the field

#Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1;#Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value @SendUsername;#Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value @SendPassword


I would appriate anyhelp you could send,
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Mon Apr 18, 2005 3:50 pm   
 
Is Outlook Express your DEFAULT email program?
I am prolly wrong, but willing to bet that it needs it set as default to work.
_________________
Reply with quote
geengyr
Newbie


Joined: 05 Sep 2004
Posts: 6

PostPosted: Sat Apr 23, 2005 6:16 pm   
 
well after trying to change Outlook to my default email prog it still does not work, But I will let you know if I do figure out the problem.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Sep 21, 2006 8:00 pm   
 
K, it's been a year since the last posting of this, but I finally got around to even thinking about trying this, and I can say that I can't get it to work either.

Code:
#CLASS {CDOEmail}
#ALIAS SendMessage {
  #var MsgObj %comcreate( "CDO.Message")
  #var ConfObj @MsgObj.Configuration
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
  #if (@Authenticate) {
    #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value @SendUsername
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value @SendPassword
    }
  #call @MsgObj.Configuration.Fields.Update
  #Var MsgObj.To {%1}
  #Var MsgObj.From %expand( @DefaultFrom, 1)
  #var MsgObj.Subject {%2}
  #Var MsgObj.TextBody {%3}
  #loop %numitems( {%4}) {#Call @MsgObj.AddAttachment(%item( @Attachment, %i))}
  #Call @MsgObj.Send
  #var MsgObj {}
  #var ConfObj {}
  #var Attachment {}
  }
#VAR ConfObj {}
#VAR MsgObj {}
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.gmail.com}
#VAR SmtpServerPort {465}
#VAR Authenticate {1}
#VAR SendUsername {me~@gmail.com}
#VAR SendPassword {**}
#VAR DefaultFrom {'me' me~@gmail.com}
#VAR Attachment {}
#CLASS 0


I made a change in the #loop because the class editor (God i'll miss that :( ) said there was an error. so I made it with a variable.

I do:
sendmessage me@gmail.com test test

and I get a popup box
Quote:
Parse Error
Error parsing command:
The transport failed to connect to the server

sendmessage me@gmail.com test test

I'm on WinXP Pro SP2, MS Outlook 2003 SP2, and I don't know what version of Exchange Server, and no Outlook Express, and obviously able to run zmud so I have ADO

As a test I tried the following
#VAR SendUsername {me~@gmail.com}
#VAR DefaultFrom {'me' me~@gmail.com}
sendmessage me~@gmail.com test test

Figuring maybe it was trying to @gmail.com as a variable or something. It didn't work.

I used gmails configuration help file at:
http://mail.google.com/support/bin/answer.py?answer=13276
I note tho that it says it says:
13. Check the box next to 'This server requires a secure connection (SSL)' under 'Outgoing Mail (SMTP).'

I've noted that the end part of the alias:
#var MsgObj {}
#var ConfObj {}
#var Attachment {}
is not even kicking in because MsgObj still says <OLE object: CDO.Message> after the error. so it's breaking before then.

Tested by removing #Call @MsgObj.Send and it cleared. So i'll guess something is wrong with #Call @MsgObj.Send

Something tells me that something is missing when entering the alias.
How the heck does it know what the subject is, what the text is and what the attachment is?
there's gotta be some seperator in there, but since no example was included in the original post I don't know


As a side note, I also tried using my jobs email account info with the exact same results.
_________________
http://www.Aardwolf.com

Last edited by Vitae on Sun Sep 24, 2006 1:19 am; edited 1 time in total
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Sep 22, 2006 9:51 am   
 
The error message you are getting is telling you what is wrong. It is telling you it is unable to connect to the mail server you specified. You should use command line telnet to attempt a connect to the mail server and see what goes wrong, if you can connect ok you should get a 220 response to tell you that the server is ready.

When I tried from home I got exactly the same message as you, I couldn't find any mail server I could connect to and get a 220 response. Here at work I used our work server as the email server and connected without a problem. The only issue the script had while trying to use it through my work server was the DefaultFrom, my server didn't like having the friendly name 'Me' me@you.com, it kept returning a 501 5.5.4 Invalid Address when I changed DefaultFrom to contain only me@you.com it worked fine and I received the email.

Good luck.
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 10:26 am   
 
I was at work when I was trying this. I shoulda mentioned that.
I'm home now and tried the change of the DefaultFrom and using the gmail account was still unable to get it to work.
I'll have to test it when i get to work because I can't remember my job info :)
But I know i never got that 501 error.

But i'd rather get this figured out for gmail. since I might send in game emails to people, I'd rather it be from that.

btw, did you only do test test? or was there an actual msg?
and if so, how did you seperate the subject from the body?

also, how do i "connect thru telnet" to test? it's gmail not a a unix server or something.

Edit:
Tried telnet smtp.gmail.com:465 and got a can't connect thru port 23 or something.
Like I said, I think this might be in part because of gmail wanting SSL authorization.
Leaving for work now, will test with hotmail when I get there since I don't think they need SSL
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 4:13 pm   
 
Tried it with my jobs email info and I get the same error.
Not sure what I'm doing diff and not getting a result...
_________________
http://www.Aardwolf.com
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Sep 22, 2006 4:19 pm   
 
Yep Hotmail should be a good bet for getting a connection to. The main thing to remember is whatever the server is set to you are unlikely to be allowed to relay which means you really ought to have a valid email address on that server which is what you'll set your DefaultFrom to as you have done with Gmail. As you say the port 465 is for secure email and so when you connect using "telnet smtp.gmail.com 465" you can't do or see anything because you're not using a secure layer and you should be. When Dharkael posted this he had SendUsername as one word and certainly no sign of anticipating a problem with @ but notice the anticipated problem with @ for DefaultFrom so I suggest changing
Code:
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value @SendUsername
to
Code:
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand(@SendUsername, 1)

_________________
Taz :)
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Sep 22, 2006 4:23 pm   
 
Vitae wrote:
btw, did you only do test test? or was there an actual msg?
and if so, how did you seperate the subject from the body?
Nope I used the following on the command line
Code:
sendmessage "me@you.com" "This is a test" "This message should get through with no transport error thrown"
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 5:27 pm   
 
Wish I could say it worked, but it didn't :(
I never said that port 465 was for secure email. That's the port that gmail uses, AND they want the use SSL checked. So I don't know if that's a different setting or what.
I start with:
Code:
#CLASS {CDOEmail}
#ALIAS SendMessage {
  #var MsgObj %comcreate( "CDO.Message")
  #var ConfObj @MsgObj.Configuration
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
  #if (@Authenticate) {
    #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value @SendPassword
    }
  #call @MsgObj.Configuration.Fields.Update
  #Var MsgObj.To {%1}
  #Var MsgObj.From %expand( @DefaultFrom, 1)
  #var MsgObj.Subject {%2}
  #Var MsgObj.TextBody {%3}
  #loop %numitems( {%4}) {#Call @MsgObj.AddAttachment(%item( @Attachment, %i))}
  #Call @MsgObj.Send
  #var MsgObj {}
  #var ConfObj {}
  #VAR Attachment {}
  }
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.gmail.com}
#VAR SmtpServerPort {465}
#VAR Authenticate {1}
#VAR SendUsername {me@gmail.com}
#VAR SendPassword {***}
#VAR DefaultFrom {me@gmail.com}
#VAR Attachment {}
#VAR ConfObj {}
#VAR MsgObj {}
#CLASS 0


type sendmessage "me@gmail.com" "This is a test" "This message should get through with no transport error thrown"

and end with:
Code:
#CLASS {CDOEmail}
#ALIAS SendMessage {
  #var MsgObj %comcreate( "CDO.Message")
  #var ConfObj @MsgObj.Configuration
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
  #if (@Authenticate) {
    #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
    #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value @SendPassword
    }
  #call @MsgObj.Configuration.Fields.Update
  #Var MsgObj.To {%1}
  #Var MsgObj.From %expand( @DefaultFrom, 1)
  #var MsgObj.Subject {%2}
  #Var MsgObj.TextBody {%3}
  #loop %numitems( {%4}) {#Call @MsgObj.AddAttachment(%item( @Attachment, %i))}
  #Call @MsgObj.Send
  #var MsgObj {}
  #var ConfObj {}
  #VAR Attachment {}
  }
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.gmail.com}
#VAR SmtpServerPort {465}
#VAR Authenticate {1}
#VAR SendUsername {me@gmail.com}
#VAR SendPassword {***}
#VAR DefaultFrom {me@gmail.com}
#VAR Attachment {}
#VAR ConfObj {<OLE object: CDO.Message.Configuration>}
#VAR MsgObj {<OLE object: CDO.Message>}
#CLASS 0
_________________
http://www.Aardwolf.com

Last edited by Vitae on Sun Sep 24, 2006 1:22 am; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 5:49 pm   
 
I walked thru some of this step by step:

Copy & Paste to clear:
#var MsgObj {}
#var ConfObj {}


---
Copy & Paste:
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration


Results:
#VAR MsgObj {<OLE object: CDO.Message>}
#VAR ConfObj {<OLE object: CDO.Message.Configuration>}


I'll assume that's right.

---
Copy & Paste:
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2

Result:
#VAR ConfObj {<OLE object: CDO.Message.Configuration>}

---

Now, I know nothing about how this works, but shouldn't there have been a change there?
BTW, taking the whole expand on command line yadda yadda stuff, I put it in a test alias:

#ALIAS test {#var MsgObj %comcreate( "CDO.Message");#var ConfObj @MsgObj.Configuration;#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2}

and got the same result of no change.

I've also tried this with my job's account info, and my yahoo account (smtp.mail.yahoo.com port 25) with no success.

So, what the heck did YOU do that worked :(
_________________
http://www.Aardwolf.com

Last edited by Vitae on Fri Sep 22, 2006 6:01 pm; edited 2 times in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 5:55 pm   
 
Taz wrote:
Yep Hotmail should be a good bet for getting a connection to.
BAH! Hotmail uses IMAP not SMTP. I'd forgotten that. So, back to trying to figure out gmail.
_________________
http://www.Aardwolf.com
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Sep 22, 2006 9:24 pm   
 
Code:
raven:tas ~>host -t MX hotmail.com
hotmail.com mail is handled by 5 mx1.hotmail.com.
hotmail.com mail is handled by 5 mx2.hotmail.com.
hotmail.com mail is handled by 5 mx3.hotmail.com.
hotmail.com mail is handled by 5 mx4.hotmail.com.
raven:tas ~>telnet mx3.hotmail.com 25
Trying 65.54.244.72...
Connected to mx3.hotmail.com.
Escape character is '^]'.
220 bay0-mc3-f19.bay0.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/. Violations will result in use of equipment located in California and other states. Fri, 22 Sep 2006 14:21:32 -0700
I can't see a problem with Hotmail and SMTP, I got a 220 - Server ready.

You will definitely have to AUTH though otherwise you'll get 550 Unable to relay.
_________________
Taz :)
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Sep 22, 2006 10:11 pm   
 
Ok fixed it for you to use Gmail.
Code:
#CLASS {CDOEmail}
#ALIAS SendMessage {#var MsgObj %comcreate("CDO.Message");#var ConfObj @MsgObj.Configuration;#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2;#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer;#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort;#if (@Authenticate) {#Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True;#Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1;#Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand(@SendUsername, 1);#Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand(@SendPassword, 1)};#call @MsgObj.Configuration.Fields.Update;#Var MsgObj.To {%1};#Var MsgObj.From %expand(@DefaultFrom, 1);#var MsgObj.Subject {%2};#Var MsgObj.TextBody {%3};#loop %numitems({%4}) {#Call @MsgObj.AddAttachment(%item(%4,%i))};#Call @MsgObj.Send;#var MsgObj {};#var ConfObj {}}
#VAR ConfObj {} {}
#VAR MsgObj {} {}
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.gmail.com}
#VAR SmtpServerPort {465}
#VAR Authenticate {1}
#VAR SendUsername {vitae666}
#VAR SendPassword {****}
#VAR DefaultFrom {'Vitae' vitae666@gmail.com}
#CLASS 0
Code:
sendmessage "me@you.com" "Test" "Enjoy the lovely attachments of duck in bmp and png format." "c:\temp\duck.bmp|c:\temp\quack.png"
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Sep 22, 2006 11:54 pm   
 
This is the point where I fall on the floor and worship you.
*grovel*
How'd ya come up with the smtpusessl?

Now I'll just see about being able to convert this to a prompt driven thing and I should be all good.

Thanks so very much.

BTW: Funny story. I put the code in, ran it and got the same error.
Cursed and raged that it wasn't working for me but worked for you.
Then I changed the **** to my password Embarassed
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sat Sep 23, 2006 1:57 am   Menu Mode
 
And in my never ending quest to make codes better:

Code:
#MENU {Send Email} {#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#PROMPT EmailTo "Send to who?"
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
}
See something that you want to email? Funny quote? Something good on the joke board? Hilite it, right click, select "Send Email", type in the email of the person you want to send it to, press OK, and email away!
I made it with a default subject.
My next step is to make a prompt for the subject as well. Maybe with a yes/no question for having a default and a typed in version.
My other next step is for a yes/no list of people that you normally send email to. Will incorporate that into the sendmessage alias as well.
I'll post my diff versions as I come up with them. Different people want it different ways.

Interesting fact, I'd originally had the #prompt as the 1st entry in the script and weird things would happen. Double sends, fails, "Send Email" as the only body of the email. Moved it to where it is now and it works fine so far as I can tell from 5 tests.
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sat Sep 23, 2006 2:43 am   #YES/NO Version
 
Code:
#MENU {Send Email2} {#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#YESNO {p:"Whom Do You Want To Send This To?"} {Myself:#VARIABLE EmailTo {"me@gmail.com"}} {Someoneelse:#VARIABLE EmailTo {"Someoneelse@gmail.com"}} {Group:#VARIABLE EmailTo {"me@gmail.com, someone@gmail.com, YetAnotherSomeone@gmail.com"}} {NotListed:#PROMPT EmailTo "Send to who?"} {More:#YESNO {p:"Whom Else Might You Want To Send This To?"} {OMGSomeoneElse:#VARIABLE EmailTo {"someone@gmail.com"}} {NotListed:#PROMPT EmailTo "Send to who?"}}
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
#var EmailTo {}
}


Like the other one but with a twist. hilite, right click, select "Send Email2"
#YES/NO will kick in. Select who you want to send it to and it's sent.
Person you want to send it to not on that screen? Click more and go to your next list of people. Person you want to send it to not on your list at all because it's someone new? click NotListed, and type in the email address, click OK and it's sent.
Got a GROUP of people that you normally send stuff to? Pre-made Group already included. Want to send it to a few people that aren't on your list already? Click NotListed and seperate the emails with a comma, and send it to them!

NOTE: had to put quotes around each #YES/NO entry otherwise it would throw an error. Would try to send to emailid without the domain. In other words Someoneelse and not Someoneelse@gmail.com
_________________
http://www.Aardwolf.com

Last edited by Vitae on Sun Sep 24, 2006 1:25 am; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Sep 24, 2006 1:04 am   
 
Core entries:

#CLASS {CDOEmail4}
#VAR ConfObj {} {}
#VAR MsgObj {} {}
#VAR cdoprefix {http://schemas.microsoft.com/cdo/configuration/}
#VAR SmtpServer {smtp.gmail.com}
#VAR SmtpServerPort {465}
#VAR Authenticate {1}
#VAR SendUsername {You@gmail.com}
#VAR SendPassword {password}
#VAR DefaultFrom {'Name' Username}
#VAR Attachment {} {}
#VAR EmailTo {} {}
#CLASS 0

Code:
#ALIAS SendMessage {
 #var MsgObj %comcreate( "CDO.Message")
 #var ConfObj @MsgObj.Configuration
 #Var ConfObj.Fields(%concat( @cdoprefix, "sendusing")).Value 2
 #Var ConfObj.Fields(%concat( @cdoprefix, "smtpserver")).Value @SmtpServer
 #Var ConfObj.Fields(%concat( @cdoprefix, "smtpserverport")).Value @SmtpServerPort
 #if (@Authenticate) {
   #Var ConfObj.Fields(%concat( @cdoprefix, "smtpusessl")).Value True
   #Var ConfObj.Fields(%concat( @cdoprefix, "smtpauthenticate")).Value 1
   #Var ConfObj.Fields(%concat( @cdoprefix, "sendusername")).Value %expand( @SendUsername, 1)
   #Var ConfObj.Fields(%concat( @cdoprefix, "sendpassword")).Value %expand( @SendPassword, 1)
 }
 #call @MsgObj.Configuration.Fields.Update
 #Var MsgObj.To {%1}
 #Var MsgObj.From %expand( @DefaultFrom, 1)
 #var MsgObj.Subject {%2}
 #Var MsgObj.TextBody {%clip}
 #Var Attachment {%3}
 #loop %numitems( {%3}) {#Call @MsgObj.AddAttachment( %item( @Attachment, %i))}
 #Call @MsgObj.Send
 #var MsgObj {}
 #var ConfObj {}
 #var Attachment {}
}
Usage:
sendmessage "TO" "SUBJECT" "MESSAGE" "ATTACHMENTS" (seperate attachments by |)
sendmessage "me@you.com" "Test" "Enjoy the lovely attachments of duck in bmp and png format." "c:\temp\duck.bmp|c:\temp\quack.png"


Code:
#MENU {Send Email1} {
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
}
#VAR EmailTo {Email@gmail.com}
This one is if you like to send stuff that you copy to yourself (or to someone else). The EmailTo var has to replace the one in the "core" part, and put in who gets it. (Yourself, one other person, or a group (seperated by commas))
Usage:
Hilite, rightclick, select Send Email1.


Code:
#MENU {Send Email2} {
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#PROMPT EmailTo "Send to who?"
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
}
Usage:
Hilite, rightclick, select Send Email2, type email to send to.


Code:
#MENU {Send Email3} {
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#YESNO {p:"Whom Do You Want To Send This To?"} {Myself:#VARIABLE EmailTo {me%char( 64)gmail.com}} {Someoneelse:#VARIABLE EmailTo {"Someoneelse@gmail.com"}} {Group:#VARIABLE EmailTo {"me@gmail.com, someone@gmail.com, YetAnotherSomeone@gmail.com"}} {NotListed:#PROMPT EmailTo "Send to who?"} {More:#YESNO {p:"Whom Else Might You Want To Send This To?"} {OMGSomeoneElse:#VARIABLE EmailTo {"yetsomeonelese@gmail.com"}} {NotListed:#PROMPT EmailTo "Send to who?"}}
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
#var EmailTo {}
}
Usage:
Hilite, rightclick, select Send Email3. Select who u want to send to. No on that screen? click More for the rest of the list. Not on the list at all? click NotListed and type in the email.


Code:
#MENU {Send Email4} {
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#PICK {p:Who are you sending this to~:} {o:1} {Myself:#additem EmailTo {"me@gmail.com"}} {AltEmail:#additem EmailTo {"someone@gmail.com"}} {OMG:#additem EmailTo {"someoneelse@gmail.com"}} {Family:#additem EmailTo {"me@gmail.com, someoneelse@gmail.com, someone@gmail.com"}}
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
#var EmailTo {}
}
Usage:
Hilite, rightclick, select Send Email4. Select who u want to send to.


Code:
#MENU {Send Email5} {
#var MsgObj %comcreate( "CDO.Message")
#var ConfObj @MsgObj.Configuration
#Var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value @SmtpServer
#Var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value @SmtpServerPort
#if (@Authenticate) {
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
  #Var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value %expand( @SendUsername, 1)
  #Var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value %expand( @SendPassword, 1)
  }
#call @MsgObj.Configuration.Fields.Update
#PICK {p:Who are you sending this to~:} {
  Myself:#additem EmailTo {"~"me@gmail.com~""}} {AltEmail:#additem EmailTo {"~"someone@gmail.com~""}} {OMG:#additem EmailTo {"~"someoneelse@gmail.com~""}} {Family:#additem EmailTo {"~"me@gmail.com~""}
  #additem EmailTo {"~"someoneelse@gmail.com~""}
  #additem EmailTo {"~"someone@gmail.com~""}
  }
#Var EmailTo %expandlist( @EmailTo, ", ")
#Var MsgObj.To %expand( @EmailTo, 1)
#Var MsgObj.From %expand( @DefaultFrom, 1)
#var MsgObj.Subject {Copied from Mud}
#Var MsgObj.TextBody {%clip}
#Call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
#var EmailTo {}
}
Usage:
Hilite, rightclick, select Send Email5. Select everyone u want to send to.

Send Email3, Send Email4 & Send Email5 already have pre-defined groups so you can see how it looks.
All of of them can send to groups as long as there is a comma between the names.
#ADDKEY is used in Send Email5 for groups because of those times that you have someone you want send it to is in more than one group.
Send Email4 & 5 lack the new person to send to part, but it's easy to put in.
Also, with some edits you can obviously set prompts to type in a subject and bodies of emails.
2 - 4 lack attachment settings, but can also be easily done.

NOW the problem. if at any point you decide you don't want to send the email after the popups, clicking CANCEL or the X will throw an error. Just click the OK and ignore it.
_________________
http://www.Aardwolf.com
Reply with quote
Bremen
Novice


Joined: 26 Dec 2002
Posts: 33
Location: USA

PostPosted: Sat Feb 09, 2008 9:26 pm   Fix for Vista?
 
I had Vitae's gmail-smtp script working great in XP SP2, but now when I try it in Vista64, I get:
Quote:

Error parsing command:
At least one of the From or Sender fields is required, and neither was found.
Quote:

#var MsgObj %comcreate("CDO.Message")
#var ConfObj @MsgObj.Configuration
#var ConfObj.Fields(%concat(@cdoprefix,"sendusing")).Value 2
#var ConfObj.Fields(%concat(@cdoprefix,"smtpserver")).Value {smtp.gmail.com}
#var ConfObj.Fields(%concat(@cdoprefix,"smtpserverport")).Value 465
#var ConfObj.Fields(%concat(@cdoprefix,"smtpusessl")).Value True
#var ConfObj.Fields(%concat(@cdoprefix,"smtpauthenticate")).Value 1
#var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value {me~@gmail.com}
#var ConfObj.Fields(%concat(@cdoprefix,"sendpassword")).Value {****}
#call @MsgObj.Configuration.Fields.Update
#PROMPT EmailTo "Send to who?"
#var MsgObj.To %expand(@EmailTo, 1)
#var MsgObj.Subject {Aardwolf Copied Text}
#var MsgObj.From {Bremen}
#var MsgObj.TextBody {%clip}
#call @MsgObj.Send
#var MsgObj {}
#var ConfObj {}
_________________
--Bremen, zMUD 7.21 on Windows 7 x64
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Sat Feb 09, 2008 10:54 pm   
 
#var MsgObj.From {Bremen} doesn't equate to a proper email address try #var MsgObj.From {me~@gmail.com} instead.
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Feb 11, 2008 4:01 pm   
 
Taz wrote:
#var MsgObj.From {Bremen} doesn't equate to a proper email address try #var MsgObj.From {me~@gmail.com} instead.
Taz, if ya looked at MY post you'd see that there is an actual value for that:

#Var MsgObj.From %expand( @DefaultFrom, 1)

SOO..what Bremen is saying is that THAT part seems to break in Vista.

OR
#var ConfObj.Fields(%concat(@cdoprefix,"sendusername")).Value {me~@gmail.com}
isn't parsing out right...

At least that's what i THINK he's saying
_________________
http://www.Aardwolf.com
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Feb 11, 2008 7:26 pm   
 
I was going by what they had pasted in the code box where everything is hard coded except for the to address which is prompted for.

EDIT: Using the posted code I confirm that if the From is set to Bremen it produces the error message posted under Vista, changing From to a valid email address sends the email as expected.
_________________
Taz :)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Feb 23, 2009 3:59 am   
 
Yay! I'm pulling a Vitae and reviving this old thread again! But it's so useful...

I'm using it for CMUD. Quite compatible. Only problem is, it's returning:

Quote:
The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available.


It's through gmail, so I used the updated one. Don't know what the message means, but it's disheartening because I really, really, REALLY want to have an email script so I can email myself things from the MUD. Any ideas? Or can anyone come up with a much better email script now that CMUD is about?

Awaiting responses...

Charneus
Reply with quote
Bremen
Novice


Joined: 26 Dec 2002
Posts: 33
Location: USA

PostPosted: Mon Feb 23, 2009 5:21 am   
 
Lucky you, I still had this topic on email-notify, haha.

Some googling indicates that that particular email error message is due to an incorrect SMTP login. Are you using the right (a valid gmail) sendusername and sendpassword in the ConfObj?
_________________
--Bremen, zMUD 7.21 on Windows 7 x64
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net