Jump to content

Recommended Posts

I read a thread about a smtp emailer, but when I run it I get error 0 1. I think that is because I didn'thave a good smtp server, mainly because I have no idea what that is. I have a php file that sends an anonymous email quite easily so that seems pretty easy.

I'm not a spammer, I don't even want it to be anonymous, I just want to know if Autoit can send emails.

I want to email once a week to a specific email.

I couldn't find any functions that did this. Maybe it's becauseI don't really know how email works.

Link to comment
Share on other sites

I read a thread about a smtp emailer, but when I run it I get error 0 1. I think that is because I didn'thave a good smtp server, mainly because I have no idea what that is. I have a php file that sends an anonymous email quite easily so that seems pretty easy.

I'm not a spammer, I don't even want it to be anonymous, I just want to know if Autoit can send emails.

I want to email once a week to a specific email.

I couldn't find any functions that did this. Maybe it's becauseI don't really know how email works.

HI,

search for smtp in Scripts & ... . There is a func which can send mails.

I think, you'll need autoit beta!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

search for smtp in Scripts & ... . There is a func which can send mails.

I think, you'll need autoit beta!

So long,

Mega

I've been working on this script ever since then and I just don't know what to do any more. This is the page I found that was closest to what I want: GUI emailer

#include <GUIConstants.au3>
GUICreate&#40;"SMTP 25 1.1 by AsimZameer"&#41;
GUICtrlCreateLabel &#40;"Smtp &#58;", 20, 10, 50&#41;
GUICtrlCreateLabel &#40;"From &#58;", 20, 40, 50&#41;
GUICtrlCreateLabel &#40;"To &#58;", 20, 70, 50&#41;
GUICtrlCreateLabel &#40;"Name &#58;", 20, 100, 50&#41;
GUICtrlCreateLabel &#40;"Subject &#58;", 20, 130, 50&#41;
GUICtrlCreateLabel &#40;"Body &#58;", 20, 160, 50&#41;
GUICtrlCreateLabel &#40;"Status &#58;", 5, 215, 50&#41;

$input1 = GUICtrlCreateInput&#40;"mx1.mail.yahoo.com",70,10,250,20&#41;
$input2 = GUICtrlCreateInput&#40;"snip",70,40,250,20&#41;
$input3 = GUICtrlCreateInput&#40;"snip",70,70,250,20&#41;
$input4 = GUICtrlCreateInput&#40;"asimzameer",70,100,250,20&#41;
$input5 = GUICtrlCreateInput&#40;"test message",70,130,250,20&#41;
$input6 = GUICtrlCreateInput&#40;"Hello WOW ASIM SMTP really Works",70,160,250,20&#41;
$myedit=GUICtrlCreateEdit &#40;"Readme&#58; After click on Send Button Wait Until status = 3 When Status = 3 it Means Email Successfully sent & Please Fill all Boxs Correctly If SMTP Address Not Works Automatically Exit and Close "& @CRLF, 1,230,400,70,$WS_DISABLED&#41;
$btn = GUICtrlCreateButton &#40;"Send", 160, 310, 60, 20&#41;
GUISetState &#40;&#41;
While 1
$msg = GUIGetMsg&#40;&#41;
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
If $msg = $btn Then
$g_IP = GUICtrlRead&#40;$input1&#41;
$sData1 = "HELO " & GUICtrlRead&#40;$input4&#41; & @CRLF
$sData2 = "MAIL FROM&#58; <" & GUICtrlRead&#40;$input2&#41; &">" & @CRLF
$sData3 = "RCPT TO&#58; <" & GUICtrlRead&#40;$input3&#41; &"> "& @CRLF
$sData4 = "DATA" & @CRLF
$sData5 = "From&#58;" & GUICtrlRead&#40;$input4&#41; & "< " & GUICtrlRead&#40;$input2&#41; &" >" & @CRLF
$sData6 = "To&#58;" & GUICtrlRead&#40;$input3&#41; & @CRLF
$sData7 = "Subject&#58;" & GUICtrlRead&#40;$input5&#41; & @CRLF
$sData8 = "Sender&#58; Microsoft Outlook Express 6.00.2800.1158" & @CRLF
$sData9 = "Mime-Version&#58; 1.0" & @CRLF
$sData10 = "Content-Type&#58; text/plain; charset=US-ASCII" & @CRLF
$sData11 = @CRLF
$sData12 = GUICtrlRead&#40;$input6&#41; & @CRLF
$sData13 = "." & @CRLF
TCPStartUp&#40;&#41;
$socket = TCPConnect&#40;TCPNameToIP&#40;$g_IP&#41;, 25&#41;
If $socket = -1 Then Exit
$ret1 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData1&#41; &#41;
sleep&#40;100&#41;
$ret2 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData2&#41; &#41;
sleep&#40;100&#41;
$ret3 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData3&#41; &#41;
sleep&#40;100&#41;
$ret4 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData4&#41; &#41;
sleep&#40;100&#41;
$ret5 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData5&#41; &#41;
sleep&#40;100&#41;
$ret6 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData6&#41; &#41;
sleep&#40;100&#41;
$ret7 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData7&#41; &#41;
sleep&#40;100&#41;
$ret8 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData8&#41; &#41;
sleep&#40;100&#41;
$ret9 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData9&#41; &#41;
sleep&#40;100&#41;
$ret10 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData10&#41; &#41;
sleep&#40;100&#41;
$ret11 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData11&#41; &#41;
sleep&#40;100&#41;
$ret12 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData12&#41; &#41;
sleep&#40;100&#41;
$ret13 = GUICtrlSetData &#40;$myedit,TCPSend&#40;$socket, $sData13&#41; &#41;
sleep&#40;100&#41;
EndIf
Wend

but I don't want all the GUI, I just want to send 1 email to an adderss I know, from an address I know, the content I know, I know everything I want to send.

I have tried editing it down and have come up with:

$body = "MESSAGE HERE"

$sData1 = "HELO " & "asimzameer" & @CRLF
$sData2 = "MAIL FROM&#58; <" & "snip" & ">" & @CRLF
$sData3 = "RCPT TO&#58; <" & "scythetleppo@yahoo.com" &"> "& @CRLF
$sData4 = "DATA" & @CRLF
$sData5 = "From&#58;" & "asimzameer" & "< " & "emailaddressremoved" & " >" & @CRLF
$sData6 = "To&#58;" & "scythetleppo@yahoo.com" & @CRLF
$sData7 = "Subject&#58;" & "test message" & @CRLF
$sData8 = "Sender&#58; Microsoft Outlook Express 6.00.2800.1158" & @CRLF
$sData9 = "Mime-Version&#58; 1.0" & @CRLF
$sData10 = "Content-Type&#58; text/plain; charset=US-ASCII" & @CRLF
$sData11 = @CRLF
$sData12 = $body & @CRLF
$sData13 = "." & @CRLF
TCPStartUp&#40;&#41;
$socket = TCPConnect&#40;TCPNameToIP&#40;'mx1.mail.yahoo.com'&#41;, 25&#41;
If $socket = -1 Then Exit
$ret1 = TCPSend&#40;$socket, $sData1&#41;
sleep&#40;100&#41;
$ret2 = TCPSend&#40;$socket, $sData2&#41;
sleep&#40;100&#41;
$ret3 = TCPSend&#40;$socket, $sData3&#41;
sleep&#40;100&#41;
$ret4 = TCPSend&#40;$socket, $sData4&#41;
sleep&#40;100&#41;
$ret5 = TCPSend&#40;$socket, $sData5&#41;
sleep&#40;100&#41;
$ret6 = TCPSend&#40;$socket, $sData6&#41;
sleep&#40;100&#41;
$ret7 = TCPSend&#40;$socket, $sData7&#41;
sleep&#40;100&#41;
$ret8 = TCPSend&#40;$socket, $sData8&#41;
sleep&#40;100&#41;
$ret9 = TCPSend&#40;$socket, $sData9&#41;
sleep&#40;100&#41;
$ret10 = TCPSend&#40;$socket, $sData10&#41;
sleep&#40;100&#41;
$ret11 = TCPSend&#40;$socket, $sData11&#41;
sleep&#40;100&#41;
$ret12 = TCPSend&#40;$socket, $sData12&#41;
sleep&#40;100&#41;
$ret13 = TCPSend&#40;$socket, $sData13&#41;

but now I don't receive the email. Why is this so difficult to just send 1 email!

Edited by Jon
Email address removed
Link to comment
Share on other sites

Hi,

try this:

Change this:

$rc = _INetSmtpMailCom('mail.gmx.net', "DisplayName", "FROM YourAdress@xxx.xx", "TO YourAdress@xxx.xx", "Test Subject", "Test <b>Body</b>", "", "","", "Usernmae", "password")

#include<file.au3>
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$rc = _INetSmtpMailCom('mail.gmx.net', "DisplayName", "FROM YourAdress@xxx.xx", "TO YourAdress@xxx.xx", "Test Subject", "Test <b>Body</b>", "", "","", "Usernmae", "password")
If @error then
    msgbox(0,"Error sending message","Error code:" & @error & "  Description:" & $rc)
EndIf

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
;Update settings
    $objEmail.Configuration.Fields.Update
; Sent the Message
    $objEmail.Send
    if @error then
        SetError(2)
        return $oMyRet[1]
    EndIf
EndFunc;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description,3)
    ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
EndFunc;==>MyErrFunc

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I get error code 2, error 501 bad syntax for the server.

HI,

show me the code you changed. (the red one) But don't forget to **** your password :think:

Besides, the func works great for me. So, there is a way we can fix it.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

$rc = _INetSmtpMailCom('smtp.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword")

also

$rc = _INetSmtpMailCom('smtp.google.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "", "")

also

$rc = _INetSmtpMailCom('x1.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword")

I guess I don't understand what to put for the values.

Link to comment
Share on other sites

$rc = _INetSmtpMailCom('smtp.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword")

also

$rc = _INetSmtpMailCom('smtp.google.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "", "")

also

$rc = _INetSmtpMailCom('x1.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword")

I guess I don't understand what to put for the values.

HI,

you can see it here, what paras you do need.

_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")

And don't put the FROM and TO there. I think, then it should work!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Yesss it works beautiful thanks!

:think: One good deed a day. :(

Glad, that I could help.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...