23rd August 2008 - There was an issue with our name caching server at around 08:00AM GMT. It has been fixed.

Sending email

Scripting help and - or code

Sending email

Postby JakeBullet on Wed Jun 04, 2008 1:19 pm

* Sending email notifications *
I spent a quite few hours on this one. I did NOT want to install outlook or other email clients to just to send a simple stupid email.

So I found...

Some free programs http://www.blat.net/ and some nice VB DLLS to do it. Problem is nothing worked with gmail or other services as newer mail servers require SSL. Spammers killed the free mail servers

So... Here you go!!!

Add this to your eHomeClientFunct.vbs file
(if you have V5.16 or above this is there already there)


Code: Select all
'====================================================================================================================
Function ehSendMail(sUserName, sPW, sSMTP, sTo, sCC, sSubject, sMsg, sAttachment)
    Dim iMsg, iConf, Flds
   
    '--- more info on the CDO object
    '--- http://www.pa-software.com/scripts/?tp=vbs&sc=cdoemail
   
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
   
    iConf.Load -1 ' CDO Source Defaults
    Set Flds = iConf.Fields
    With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sUserName
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sPW
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sSMTP
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Update
    End With
    With iMsg
        Set .Configuration = iConf
        .To = sTo
        .CC = sCC
        .BCC = ""
        ' Note: The reply address is not working if you use this Gmail example
        ' It will use your Gmail address automatic. But you can add this line
        ' to change the reply address .ReplyTo = "Reply@something.com"
        .From = "<your mailid to be displayed as@gmail.com>"
        .Subject = sSubject
        .TextBody = sMsg
        If sAttachment <> "" Then .AddAttachment sAttachment
        .Send
    End With

End Function




Use this to make the call.


Code: Select all
    '---
    '--- eHomeMailNotification@gmail.com is a TEST email account I created to verify its all working
    '--- After you verify all is good - you should change to your own mail server
    '---
    Dim sUserName, sPW, sSMTP, sTo, sCC, sSubject, sMsg, sAttachment
    sUserName = "eHomeMailNotification@gmail.com"
    sPW = "eHomeMail"
    sSMTP = "smtp.gmail.com"
    sTo = "jakebullet703@hotmail.com"
    sCC = ""
    sSubject = "Alert Subject"
    sMsg = "This is a message"
    sAttachment = ""
    ehSendMail sUserName, sPW, sSMTP, sTo, sCC, sSubject, sMsg, sAttachment
   


Tested in Win2000 and XP
JakeBullet
Site Admin
 
Posts: 1101
Joined: Thu Mar 23, 2006 8:13 am

Return to Screen Designer Scripting

Who is online

Users browsing this forum: No registered users and 1 guest



FREE FORUM Hosting by AtFreeForum. Create your Free WEB FORUM Hosting now!
GROUP DISCUSSION Features - Free FORUM HOSTING Directory Listing - DISCUSSION FORUM Terms of Service - FREE PHPBB Hosting Privacy
- FASHION ACCESSORIES
cron