Jump to content

E-Mail


Recommended Posts

Hey, I am working on a E-mail option, a friend of my gave me a source and I tryed to update it, here is the script:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\tjado\Desktop\AutoIt\Form\Sod's Bday Cracker [EMS].kxf
$Form1 = GUICreate("Sod's E-Mail test", 249, 265, 192, 124)
$Group1 = GUICtrlCreateGroup("Info:", 8, 8, 233, 249)
$Label1 = GUICtrlCreateLabel("First Name:", 16, 32, 57, 17)
$Label2 = GUICtrlCreateLabel("E-Mail:", 16, 96, 36, 17)
$Label3 = GUICtrlCreateLabel("Last Name:", 16, 64, 58, 17)
$Input1 = GUICtrlCreateInput("", 104, 32, 121, 21)
$Input2 = GUICtrlCreateInput("", 104, 64, 121, 21)
$Input3 = GUICtrlCreateInput("", 104, 96, 121, 21)
$Label4 = GUICtrlCreateLabel("BirthDay above year:", 16, 128, 103, 17)
$Label5 = GUICtrlCreateLabel("BirthDay bellow year:", 16, 160, 103, 17)
$Combo1 = GUICtrlCreateCombo("Year", 144, 128, 81, 25)
GUICtrlSetData(-1, "2010|2009|2008|2007|2006|2005|2004|2003|2002|2001|2000|1999|1998|1997|1996|1995|1994|1993|1992|1991|1990|1989|1988|1987|1986|1985|1984|1983|1982|1981|1980|1979|1978|1977|1976|1975|1974|1973|1972|1971|1970|1969|1968|1967|1966|1965|1964|1963|1962|1961|1960|1959|1958|1957|1956|1955|1954|1953|1952|1951|1950|1949|1948|1947|1946|1945|1946")
$Combo2 = GUICtrlCreateCombo("Year", 144, 160, 81, 25)
GUICtrlSetData(-1, "2011|2010|2009|2008|2007|2006|2005|2004|2003|2002|2001|2000|1999|1998|1997|1996|1995|1994|1993|1992|1991|1990|1989|1988|1987|1986|1985|1984|1983|1982|1981|1980|1979|1978|1977|1976|1975|1974|1973|1972|1971|1970|1969|1968|1967|1966|1965|1964|1963|1962|1961|1960|1959|1958|1957|1956|1955|1954|1953|1952|1951|1950|1949|1948|1947|1946|1945")
$Button1 = GUICtrlCreateButton("Send", 96, 216, 75, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

    Do
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
            Exit
            Case $Button1
                $email1 = GUICtrlRead($Input1)
                $email2 = GUICtrlRead($Input2)
                $email3 = GUICtrlRead($Input3)
                $emailmsg1 = GUICtrlRead($Input1)
                $emailmsg2 = GUICtrlRead($Input2)
                $emailmsg3 = GUICtrlRead($Input3)
                $emailmsg4 = GUICtrlRead($Combo1)
                $emailmsg5 = GUICtrlRead($Combo2)
                $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED
                $FromName = "Name" ; name from who the email was sent
                $FromAddress = $email3
                If $FromAddress = "" Then
                    $FromAddress = "your@Email.Address.com" ; address from where the mail should come
                EndIf

                $ToAddress = "XXXXXXXXXX" ; destination address of the email - REQUIRED
                $Subject = "Info test" ; subject from the email - can be anything you want it to be
                $Body = $emailmsg1 & $emailmsg2 & $emailmsg3 & $emailmsg4 & $emailmsg5 ; the messagebody from the mail - can be left blank but then you get a blank mail
                $AttachFiles = "" ; the file you want to attach- leave blank if not needed
                $CcAddress = "" ; address for cc - leave blank if not needed
                $BccAddress = "" ; address for bcc - leave blank if not needed
                $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
                $Username = "XXXXXXXXXX" ; username for the account used from where the mail gets sent - REQUIRED
                $Password = "XXXXXXXX" ; password for the account used from where the mail gets sent - REQUIRED
                ;$IPPort = 25                            ; port used for sending the mail
                ;$ssl = 0                                ; enables/disables secure socket layer sending - put to 1 if using httpS
                $IPPort = 465 ; GMAIL port used for sending the mail
                $ssl = 1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

                _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
                ExitLoop (1)
        EndSwitch
    Until $nMsg = $GUI_EVENT_CLOSE
    GUIDelete($Form1)

The XXXXX are persenal info, so thats not the error, I get a error at the following line:

_INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)

Can someone please help me?

~Thanks

Edited by SoundOfDeath
Link to comment
Share on other sites

What error message do you get?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The line

#include <INet.au3>
is missing in your script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

That is because it is not part of the standard UDF's supplied with AutoIt3.

Search for it in the Examples forum will do miracles. :mellow:

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...