eye.jpg
 
                      AutoSoft Systems
        AutoSoft Systems 2 Round Hill Court
        East Greenwich, RI 02818
        401.885.3631
        401.884.5653 Fax
                        401.996.3631 Cell
AMDG       "Once you know it, it's Easy!" autosoft@aol.com
Commercial and custom computer related products spanning the areas of data acquisition and control, simulation and modeling, numerical analysis, chemical process design and manufacturing management information systems design. Founded in 1982.
We know Excel! Whenever possible, Excel is the user interface, VBA is the programming language, ODBC connects to the database of your choice.
Home About Us Literature Wire & Cable Pharmaceutical & Biotech Construction Management Commercial Products Custom Solutions
Contact Us Events Downloads
                            AMDG
MCj04415190000[1]
Programmatically Sending
Emails and Text Messages
                             
Several of the SMART tools programmatically send emails and text messages for either periodic or exception reporting.  This screen documents the several ways that it is accomplished.
Both emails and text messaging can be treated in identical fashion. For example, my email is  autosoft@aol.com  
You can send a text message to my phone using this address: 4019963631@vtext.com (Verizon).
                             
The domain for all major US carriers: Carrier  Send Email to phonenumber@....   
  Alltel  @message.alltel.com           
    AT&T  @mms.att.net        
    Nextel  @messaging.nextel.com           
    Sprint  @messaging.sprintpcs.com           
    SunCom  @tms.suncom.com           
    T-mobile  @tmomail.net           
    VoiceStream  @voicestream.net           
    Verizon  @vtext.com (text only)           
    Verizon  @vzwpix.com (pictures and videos)     
There are several ways to send an email in Excel
SendMail Method
By far the simplest way to do so is by using the SendMail method. This sends an email with the active document as an attachment. Being a lazy programmer, I often create a blank document just to send an email this easy way.
  This example sends the active workbook to a single recipient.
ActiveWorkbook.SendMail recipients:="autosoft@aol.com"
FollowHyperlink Method
Simply build a URL        
curl = "mailto:" & cEmail & "?subject=" & cSubj & "&body=" & cBody
curl = Left(curl, 2025) 'was successful with 2025   , not with 2045
'--     Execute the URL (start the email client)
ActiveWorkbook.FollowHyperlink (curl)
BLAT
www.blat.net                            
Blat is a Win32 command line SMTP mailer.
Sample code that uses Blat:
         
Sub Blat(vRECIPIENTS As String, vSUBJECT As String, vMSG1 As String)
    vMAILSERVER = "172.16.1.219" ' DEFINE MAIL SERVER (Exch2007 Server IP Address
    vSENDEREMAIL = "SAFEmail@CMCorporation"  ' Default Sender for ECR.
    vMSGFILE = ThisWorkbook.Path + "\Blat\MSG.TXT" 'CREATE vMSGFILE FROM VARIABLES
    vRECIPIENTS = Application.WorksheetFunction.Substitute(vRECIPIENTS, ";", ",")
    vRECIPIENTS = vRECIPIENTS + "," + ThisWorkbook.Sheets("Detail").[CurrentEmail].Value + "@cmcorporation.com"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile(vMSGFILE, True)
    a.WriteLine (vMSG1 + Chr(13) + Chr(10))
    a.Close
    Set a = fs.CreateTextFile(ThisWorkbook.Path + "\blat\blatx.bat", True)
    a.WriteLine (ThisWorkbook.Path + "\blat\blat.exe """ + vMSGFILE + _
       """ -t """ + vRECIPIENTS + _
       """ -s """ + vSUBJECT + _
       """ -f """ + vSENDEREMAIL + _
       """ -server """ + vMAILSERVER + """" + _
       Chr(13) + Chr(10))
    a.Close
    Dim RetVal
    RetVal = Shell(ThisWorkbook.Path + "\blat\blatx.bat", vbHide)
End Sub
Click Yes
http://www.contextmagic.com/express-clickyes/
 
             
Outlook blocks efforts to automatically send emails.  This free utility allows the automatic emails to proceed by automatically clicking "Yes" when Outlook presents this screen.                
                               
AutoSoft Systems | 2 Round Hill Court, East Greenwich, Rhode Island, USA 02818 | 401.885.3631 | Fax: 401.884.5653 | Mobile: 401.996.3631 
This web page was last updated at 04/27/2010 06:57 PM and is written in EXCEL!
AXIOM is a Trademark of Consona - USYS is a Trademark of Zumbach - AutoSoft Systems is not affiliated with Consona nor Zumbach