Jump to content
Sign in to follow this  
SumTingWong

_SendSMTPMail UDF using AU3Xtra.dll

Recommended Posts

SumTingWong

Here's an example of how you can use Larry's TCP functions.

You need AU3Xtra.dll of course and latest beta.

Watch out for line wraps...

See version 0.00000002 below!

EDIT1: added @CRLF to the QUIT command

Edited by pacman

Share this post


Link to post
Share on other sites
sykes

Very slick pacman ... works like a charm


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites
SumTingWong

Version 0.00000002

- Added checks and balances based on server responses and return 1 if message sent and 0 if message not sent

- You can now send to multiple recipients by separating their email addresses with a comma in the recipient list.

Again, watch out for line wraps because of my multi-level if/then/else nests. :idiot:

See my latest post for updated version.

Edited by SumTingWong

Share this post


Link to post
Share on other sites
Spaghetti prog

file attachment feature would be great !


goto is evil

Share this post


Link to post
Share on other sites
Jos

file attachment feature would be great !

<{POST_SNAPBACK}>

yea, you will only have do a BASE64 conversion for the files to be attached first. :">

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
steve8tch

I'm going to study that code above - just to learn how the dllcall and socket stuff works - what an amazing bit of code !!! :idiot:

You should include it in the help file as a real life tcp connect example.

Well done - brilliant ..

(recently I have been fileinstalling bmail and sending email with 3 lines of code!! - it works but I didn't learn anything by doing it. :"> )

Share this post


Link to post
Share on other sites
this-is-me

Pacman, I know this is a hard thing to ask, but could you present some sample code on how to set up a SIMPLE webserver with the tcp stuff?

EDIT: Nevermind the previous question, I am going to try making it myself. It looks like one of the simplest things to do.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites
this-is-me

Yea, It is for my personal use only, so only one connection is enough (me). I intend to do an extremely simple page that can be accessed by my phone with wap and control certain simple things on my system. I know I am opening myself up for a good buffer overflow here, but I think I will be OK since I will only use it a little.


Who else would I be?

Share this post


Link to post
Share on other sites
SumTingWong

A problem with adding file attachments using AutoIT is that fact that it doesn't support binary files. Can't do a BASE64 conversion if you can't read the file in the first place. :idiot:

@this-is-me - to get you on your way:

Disclaimer: this code is converted from a VB function by Francesco Balena

Dim $s

$s = _HTMLEncode("This is a "" & 5 is > 2 or 2 is < 5")
MsgBox(4096,'debug:' , '$s:' & $s);### Debug MSGBOX 

Func _HTMLEncode($sText)
   Local $nASCII
   Local $sReplace
   Local $n
   
   For $n = StringLen($sText) To 1 Step -1
      $nASCII = Asc(StringMid($sText, $n, 1))
      Select
      Case $nASCII = 32
         $sReplace = "&nbsp;"
      Case $nASCII = 34
         $sReplace= "&quot;"
      Case $nASCII = 38
         $sReplace = "&amp;"
      Case $nASCII = 60
         $sReplace = "&lt;"
      Case $nASCII = 62
         $sReplace = "&gt;"
      Case $nASCII >= 32 And $nASCII <= 127
        ; other alphanumeric chars
      Case Else
         $sReplace = "&#" & String($nASCII) & ";"
      EndSelect
      If StringLen($sReplace) Then
            $sText = StringLeft($sText, $n-1) & $sReplace & StringMid($sText, $n+1)
            $sReplace = ""
      EndIf
   Next
   Return $sText
EndFunc

Share this post


Link to post
Share on other sites
JSThePatriot

I am not sure that I am doing anything wrong, but I am having trouble.

_SendSMTPMail() doesnt seem to work, but it doesnt give any errors?? Could you explain the debug box? (What do different numbers mean?)

I have every field filled in properly. I send the email and the program terminates so I know that it works but I never recieve the email :(.

My code:

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;---*** Begin Declarations ***---
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Dim $oIP, $oPT, $oPW;Old Values
Dim $nIP, $nPT, $nPW;New Values
Dim $eAddyTo, $eAddyFrom, $serverIP;Email Addresses/Server IP
Dim $eSubject, $eBody;Email Subject, Body
Dim $eDebug;Email Debug variable.

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;---*** Main Program Body ***---
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

;Make IPSend Run on startup.
If Not(RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "IPSend.exe")) Then
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "IPSend.exe", "REG_SZ", @ScriptFullPath)
EndIF

;Make sure VNC Server is running.
If Not(ProcessExists("winvnc.exe")) Then
    Run("C:\Program Files\UltraVNC\winvnc.exe", "C:\Program Files\UltraVNC\")
EndIf

;Set all variables from INI file.
$oIP = INIRead("ipsend.sec", "VNC Info", "oIP", "")
$oPT = INIRead("ipsend.sec", "VNC Info", "oPT", "")
$oPW = INIRead("ipsend.sec", "VNC Info", "oPW", "")
$eAddyTo = INIRead("ipsend.sec", "eAddress", "eAddyTo", "")
$eAddyFrom = INIRead("ipsend.sec", "eAddress", "eAddyFrom", "")
$serverIP = INIRead("ipsend.sec", "eAddress", "serverIP", "")
$eSubject = INIRead("ipsend.sec", "eMail", "eSubject", "")
$eBody = INIRead("ipsend.sec", "eMail", "eBody", "")

;Set all the New Values
$nIP = _GetIP()
$nPT = _GetVNCPort()
$nPW = _GetVNCPass()

;If any new values are different than old values then send them off in an email.
If ($oIP <> $nIP) OR ($oPT <> $nPT) OR ($oPW <> $nPW) Then
    INIWrite("ipsend.sec", "VNC Info", "oIP", $nIP)
    INIWrite("ipsend.sec", "VNC Info", "oPT", $nPT)
    INIWrite("ipsend.sec", "VNC Info", "oPW", $nPW)
    
    $eDebug = _SendSMTPMail($serverIP, $eAddyFrom, $eAddyTo, $eSubject, $eBody)
    MsgBox(0, "_SendSMTPMail() Debug", "Debug: " & $eDebug)
EndIf

Let me know.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
jbarr

This is very interesting. I came from the WinBatch world, but the company I now work for does not use WinBatch, so I decided to throw together an AutoIT solution.

I just implemented an AutoIT application that leverages the Postie email program. It's kinda kludgy, but it is very stable, and works well.

Basically, I needed an automated solution that would look for files in a directory and email those files as attachments to recipients defined within the files. The files are .CSV data files and the first line of each file contains the recipient's email address. these files are generated by SAP and translated into .CSV format using the GENTRAN EDI translator. The resulting files get dropped into a work directory, and a process executes every few minutes that looks for and processes any files.

Here's the basic flow:

1. Start with a "working" directory.

2. Build a list of all files in that directory to process. This part is critical because it gives me a "snapshot" of the files at execution time. That way, any files that may drop into the directory during execution get will processed on the next execution. Everything needs to process, and everything needs to be accounted for.

3. Loop through the file list and process each file as follows:

3.1 Read the first line of the file. The first line contains the recipient's email address.

3.2 Build a complete Postie command string and write it to a batch file in a work directory. The postie command includes the to, from, subject, host, etc. The file being read is included in the Postie command string as an attachment. Almost all parameters are static except for the filename and the recipient. The static parameters are read from a .ini file for easy maintenance.

3.3 Execute the Postie batch file. This actually sends the file.

3.4 Move the data file and the Postie batch files to archive directories. Remember, I am only moving the files in the original file list as well as associated batch files. Any new files will get processed on the next run.

4. loop back to get next filename to process.

Misc:

I revise all filenames to include date and time stamps based on execution time. This aids in tracability.

I added lines in the code to write to log a file at critical points to help with occasional troubleshooting.

My only real problem is that I don't like the idea of having to jump out to execute Postie. At that point, I lose some control over execution status. Yes, Postie can return an error level that is handled by AutoIT, but it's a success / fail status. I cannot tell what errors actually occur if any. Fortunatly, I retain archives of the generated batch files so I can troubleshoot later if needed.

But a full AutoIT solution would be much nicer!

I can upload the sources if you want...


Visit Jim's Tips for lots of cool tips on Gmail, SageTV, PDA's, and whatever else interests me!

Share this post


Link to post
Share on other sites
SumTingWong

Since you dug this up from the archive, I just couldn't resist updating it for the latest beta.

JS, hopefully the code is easier to read and troubleshoot without all the DllCall stuff.

Opt("MustDeclareVars", 1)

Dim $i

If _SendSMTPMail("localhost", _ 
                 "me@host.com", _ 
                 "youfirstbuddy@host.com, yoursecondbuddy@host.com, yourthirdbuddy@host.com", _ 
                 "Test email", _ 
                 "This is a test email") Then
    MsgBox(0, "_SendSMTP", "Message sent!")
EndIf

Func _SendSMTPMail($sServer, $sSender, $sRecipients, $sSubject, $sBody)
    Local $hSocket
    Local $sData
    Local $aRcptList
    Local $nRcptOK = 0
    Local $bSent = False
    Local $n
    
; Start TCP services
    If Not TCPStartup() Then Return False
; Connect to SMTP server
    $hSocket = TCPConnect(TCPNameToIP($sServer), 25)
    If $hSocket <> -1 Then
        Sleep(100)
    ; Read 220 response from server
        $sData = TCPRecv($hSocket, 1024)
        If StringLeft($sData, 3) = "220" Then
            Sleep(100)
            $sData = "HELO " & @ComputerName & @CRLF
        ; Send HELO to server
            If TCPSend($hSocket, $sData) > 0 Then
                Sleep(100)
            ; Receive 250 response from server
                $sData = TCPRecv($hSocket, 1024)
                If StringLeft($sData, 3) = "250" Then
                    Sleep(100)
                    $sData = "MAIL FROM: <" & $sSender & ">" & @CRLF
                ; Send MAIL FROM command to server
                    If TCPSend($hSocket, $sData) > 0 Then
                        Sleep(100)
                    ; Receive 250 response from server
                        $sData = TCPRecv($hSocket, 1024)
                        If StringLeft($sData, 3) = "250" Then
                            $aRcptList = StringSplit($sRecipients, ",")
                            For $n = 1 To $aRcptList[0]
                                Sleep(100)
                                $sData = "RCPT TO: <" & StringStripWS($aRcptList[$n], 8) & ">" & @CRLF
                            ; Send RCPT TO command to server
                                If TCPSend($hSocket, $sData) > 0 Then
                                    Sleep(100)
                                ; Receive 250 response from server
                                    $sData = TCPRecv($hSocket, 1024)
                                    If StringLeft($sData, 3) = "250" Then $nRcptOK += 1
                                EndIf
                            Next
                        ; Continue if at least 1 recipient was accepted
                            If $nRcptOK > 0 Then
                                Sleep(100)
                                $sData = "DATA" & @CRLF
                            ; Send DATA command to server
                                If TCPSend($hSocket, $sData) > 0 Then
                                    Sleep(100)
                                ; Receive 354 response from server
                                    $sData = TCPRecv($hSocket, 1024)
                                    If StringLeft($sData, 3) = "354" Then
                                        Sleep(100)
                                        $sData = StringFormat("To: %s\r\nFrom: %s\r\n" & _ 
                                                              "Subject: %s\r\n" & _ 
                                                              "Date: %02d/%02d/%d %02d:%02d:%02d\r\n", _
                                                              $sRecipients, $sSender, $sSubject, _ 
                                                              @MDAY, @MON, @YEAR, @HOUR, @MIN, @SEC)
                                    ; Send message HEADER
                                        If TCPSend($hSocket, $sData) > 0 Then
                                            Sleep(100)
                                            $sData = $sBody & @CRLF
                                        ; Send message BODY
                                            If TCPSend($hSocket, $sData) > 0 Then
                                                Sleep(100)
                                                $sData = @CRLF & "." & @CRLF
                                            ; Send end of message indicator
                                                If TCPSend($hSocket, $sData) > 0 Then
                                                    Sleep(100)
                                                ; Receive 250 response from server
                                                    $sData = TCPRecv($hSocket, 1024)
                                                    If StringLeft($sData, 3) = "250" Then $bSent = True
                                                EndIf; Send end of message indicator
                                            EndIf; Send message BODY
                                        EndIf; Send message HEADER
                                    EndIf; Receive 354 response from server
                                EndIf; Send DATA command to server
                            EndIf; Continue if at least 1 recipient was accepted
                        EndIf; Receive 250 response from server
                    EndIf; Send MAIL FROM command to server
                EndIf; Receive 250 response from server
            EndIf; Send HELO to server
        EndIf; Read 220 response from server
    ; Close TCP socket
        TCPCloseSocket($hSocket)
    EndIf
; Shutdown TCP services
    TCPShutdown()
    Return $bSent
EndFunc
Edited by SumTingWong

Share this post


Link to post
Share on other sites
JSThePatriot

Since you dug this up from the archive, I just couldn't resist updating it for the latest beta.

JS, hopefully the code is easier to read and troubleshoot without all the DllCall stuff.

Opt("MustDeclareVars", 1)

Dim $i

If _SendSMTPMail("localhost", _ 
                 "me@host.com", _ 
                 "youfirstbuddy@host.com, yoursecondbuddy@host.com, yourthirdbuddy@host.com", _ 
                 "Test email", _ 
                 "This is a test email") Then
    MsgBox(0, "_SendSMTP", "Message sent!")
EndIf

Func _SendSMTPMail($sServer, $sSender, $sRecipients, $sSubject, $sBody)
    Local $hSocket
    Local $sData
    Local $aRcptList
    Local $nRcptOK = 0
    Local $bSent = False
    Local $n
    
; Start TCP services
    If Not TCPStartup() Then Return False
; Connect to SMTP server
    $hSocket = TCPConnect(TCPNameToIP($sServer), 25)
    If $hSocket <> -1 Then
        Sleep(100)
   ; Read 220 response from server
        $sData = TCPRecv($hSocket, 1024)
        If StringLeft($sData, 3) = "220" Then
            Sleep(100)
            $sData = "HELO " & @ComputerName & @CRLF
       ; Send HELO to server
            If TCPSend($hSocket, $sData) > 0 Then
                Sleep(100)
           ; Receive 250 response from server
                $sData = TCPRecv($hSocket, 1024)
                If StringLeft($sData, 3) = "250" Then
                    Sleep(100)
                    $sData = "MAIL FROM: <" & $sSender & ">" & @CRLF
               ; Send MAIL FROM command to server
                    If TCPSend($hSocket, $sData) > 0 Then
                        Sleep(100)
                   ; Receive 250 response from server
                        $sData = TCPRecv($hSocket, 1024)
                        If StringLeft($sData, 3) = "250" Then
                            $aRcptList = StringSplit($sRecipients, ",")
                            For $n = 1 To $aRcptList[0]
                                Sleep(100)
                                $sData = "RCPT TO: <" & StringStripWS($aRcptList[$n], 8) & ">" & @CRLF
                           ; Send RCPT TO command to server
                                If TCPSend($hSocket, $sData) > 0 Then
                                    Sleep(100)
                               ; Receive 250 response from server
                                    $sData = TCPRecv($hSocket, 1024)
                                    If StringLeft($sData, 3) = "250" Then $nRcptOK += 1
                                EndIf
                            Next
                       ; Continue if at least 1 recipient was accepted
                            If $nRcptOK > 0 Then
                                Sleep(100)
                                $sData = "DATA" & @CRLF
                           ; Send DATA command to server
                                If TCPSend($hSocket, $sData) > 0 Then
                                    Sleep(100)
                               ; Receive 354 response from server
                                    $sData = TCPRecv($hSocket, 1024)
                                    If StringLeft($sData, 3) = "354" Then
                                        Sleep(100)
                                        $sData = StringFormat("To: %s\r\nFrom: %s\r\n" & _ 
                                                              "Subject: %s\r\n" & _ 
                                                              "Date: %02d/%02d/%d %02d:%02d:%02d\r\n", _
                                                              $sRecipients, $sSender, $sSubject, _ 
                                                              @MDAY, @MON, @YEAR, @HOUR, @MIN, @SEC)
                                   ; Send message HEADER
                                        If TCPSend($hSocket, $sData) > 0 Then
                                            Sleep(100)
                                            $sData = $sBody & @CRLF
                                       ; Send message BODY
                                            If TCPSend($hSocket, $sData) > 0 Then
                                                Sleep(100)
                                                $sData = @CRLF & "." & @CRLF
                                           ; Send end of message indicator
                                                If TCPSend($hSocket, $sData) > 0 Then
                                                    Sleep(100)
                                               ; Receive 250 response from server
                                                    $sData = TCPRecv($hSocket, 1024)
                                                    If StringLeft($sData, 3) = "250" Then $bSent = True
                                                EndIf; Send end of message indicator
                                            EndIf; Send message BODY
                                        EndIf; Send message HEADER
                                    EndIf; Receive 354 response from server
                                EndIf; Send DATA command to server
                            EndIf; Continue if at least 1 recipient was accepted
                        EndIf; Receive 250 response from server
                    EndIf; Send MAIL FROM command to server
                EndIf; Receive 250 response from server
            EndIf; Send HELO to server
        EndIf; Read 220 response from server
   ; Close TCP socket
        TCPCloseSocket($hSocket)
    EndIf
; Shutdown TCP services
    TCPShutdown()
    Return $bSent
EndFunc

<{POST_SNAPBACK}>

I really appreciate the new code. I am trying to get my program into a full AutoIt solution. Hopefully I can get it working. Before when I was working on this I used BMail and VNCPWDump.exe now I have eliminated one of those and hopefully soon I will eliminate the other if I can ever figure out the C++ code and work it into AutoIt Code.

Thanks Again,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
JSThePatriot

This is very interesting. I came from the WinBatch world, but the company I now work for does not use WinBatch, so I decided to throw together an AutoIT solution.

I just implemented an AutoIT application that leverages the Postie email program. It's kinda kludgy, but it is very stable, and works well.

Basically, I needed an automated solution that would look for files in a directory and email those files as attachments to recipients defined within the files. The files are .CSV data files and the first line of each file contains the recipient's email address. these files are generated by SAP and translated into .CSV format using the GENTRAN EDI translator. The resulting files get dropped into a work directory, and a process executes every few minutes that looks for and processes any files.

Here's the basic flow:

1. Start with a "working" directory.

2. Build a list of all files in that directory to process. This part is critical because it gives me a "snapshot" of the files at execution time. That way, any files that may drop into the directory during execution get will processed on the next execution. Everything needs to process, and everything needs to be accounted for.

3. Loop through the file list and process each file as follows:

3.1 Read the first line of the file. The first line contains the recipient's email address.

3.2 Build a complete Postie command string and write it to a batch file in a work directory. The postie command includes the to, from, subject, host, etc. The file being read is included in the Postie command string as an attachment. Almost all parameters are static except for the filename and the recipient. The static parameters are read from a .ini file for easy maintenance.

3.3 Execute the Postie batch file. This actually sends the file.

3.4 Move the data file and the Postie batch files to archive directories. Remember, I am only moving the files in the original file list as well as associated batch files. Any new files will get processed on the next run.

4. loop back to get next filename to process.

Misc:

I revise all filenames to include date and time stamps based on execution time. This aids in tracability.

I added lines in the code to write to log a file at critical points to help with occasional troubleshooting.

My only real problem is that I don't like the idea of having to jump out to execute Postie. At that point, I lose some control over execution status. Yes, Postie can return an error level that is handled by AutoIT, but it's a success / fail status. I cannot tell what errors actually occur if any. Fortunatly, I retain archives of the generated batch files so I can troubleshoot later if needed.

But a full AutoIT solution would be much nicer!

I can upload the sources if you want...

<{POST_SNAPBACK}>

I am not sure that this _SendSMTPMail() will send attachments therefore this probably isnt the exact AutoIt solution you are looking for. I will comment more in the morning on an Edit line for this post you have made. I would agree that you should use as much of a full AutoIt solution as possible. Possibly using another email program.

Have you created the complete rest of the application?

Why are you still using batch files or is that from the postie? (What is a postie?)

Just a couple of things off the top of my head. I will get more into it tomorrow when I can think about it more clearly :-P For now I need sleep.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
SumTingWong

This UDF is only useful for small text messages. If you want to send large messages and attachments then you are better off sticking with external mail senders.

Share this post


Link to post
Share on other sites
Clever1mba

hey its not working on my machine ur code have problem i think and it also not displaying any status

i made few changes in ur code help me to display mail status or open like cmd or gui

$aRcptList = "snip"

$sSender = "snip"

$sServer = "mx4.mail.yahoo.com"

$sSubject = "TEST MAIL"

TCPStartup()

$hSocket = TCPConnect(TCPNameToIP($sServer), 25)

If $hSocket <> -1 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024) 

If StringLeft($sData, 3) = "220" Then

Sleep(100)

$sData = "HELO " & @ComputerName & @CRLF

 

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024)

If StringLeft($sData, 3) = "250" Then

Sleep(100)

$sData = "MAIL FROM: <" & $sSender & ">" & @CRLF

   

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024)

If StringLeft($sData, 3) = "250" Then

Sleep(100)

$sData = "RCPT TO: <" & $aRcptList & ">" & @CRLF

   

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024)

If StringLeft($sData, 3) = "250" Then

Sleep(100)

$sData = "DATA" & @CRLF

   

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024)

If StringLeft($sData, 3) = "354" Then

Sleep(100)

$sData = StringFormat("To: %srnFrom: %srn" & _

"Subject: %srn" & _

"Date: %02d/%02d/%d %02d:%02d:%02drn", _

$aRcptList, $sSender, $sSubject, _

@MDAY, @MON, @YEAR, @HOUR, @MIN, @SEC)

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData =  @CRLF

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = @CRLF & "." & @CRLF

If TCPSend($hSocket, $sData) > 0 Then

Sleep(100)

$sData = TCPRecv($hSocket, 1024)

If StringLeft($sData, 3) = "250" Then

Sleep(100)

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

Edited by Melba23

Share this post


Link to post
Share on other sites
JSThePatriot

hey its not working on my machine ur code have problem i think and it also not displaying any status

i made few changes in ur code help me to display mail status or open like cmd or gui

<{POST_SNAPBACK}>

I have yet to get it working properly as well. It doesnt give me any errors, but I never get any of the test messages I have sent. I may just script something for bmail.exe like I did before.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
SumTingWong

I have yet to get it working properly as well. It doesnt give me any errors, but I never get any of the test messages I have sent. I may just script something for bmail.exe like I did before.

JS

<{POST_SNAPBACK}>

Have you tried manually sending a message on your SMTP server?

Follow these steps:

1. telnet <yoursmtpserver> 25

e.g: telnet mailserver 25

If your SMTP server is working correctly, you should see a welcome message.

2. send HELO <yourcomputername>

e.g: HELO mypc01

You should get a reply beginning with 250 from the server. If you don't get anything back, it could be that you need to turn on local echo.

3. send MAIL FROM: <senderemailaddress>

e.g: MAIL FROM: <me@mydomain.com>

Unlike steps 1 and 2, <senderemailaddress> must be enclosed inside <>. You should get a reply beginning with 250

4. send RCPT TO: <recipientemailaddress>

e.g: RCPT TO: <you@yourdomain.com>

<recipientemailaddress> must be enclosed inside <>. You should get a reply beginning with 250

5. send DATA

e.g: DATA

You should get a reply beginning with 354

6. send To: <recipient>

e.g: To: you@yourdomain.com

7. send From: <sender>

e.g: From: me@mydomain.com

8. send Subject: <subject>

e.g: Subject: This is a test

9. send Date: <date>

e.g: Date: 04/06/2005 12:23:45

10. send your message

11. at the end of your message send a RETURN and a FULLSTOP and another RETURN. You should get a reply beginning with 250 to indicate that your message has been sent.

It goes without saying that each time you send a command, you should press RETURN. Most SMTP mail servers, if they are correctly configured, will not relay messages so you must enter a valid sender email address.

These are the exact steps that the UDF carries out so if you can do it manually, then the UDF should work.

Share this post


Link to post
Share on other sites
Clever1mba

helo

okay i m working on smtp when it ready for work then i will share with u .

Share this post


Link to post
Share on other sites
SumTingWong

helo

okay i m working on smtp when it ready for work then i will share with u .

<{POST_SNAPBACK}>

I got your PM but thought I would post my reply here in case other people have the same problem as you.

If you don't get a welcome message when you telnet your smtp server on port 25 then either it's not working or you are telnetting an incorrect server address.

If you get a welcome message but no response from the server when you send the first HELO command then you need to turn on telnet localecho. Assuming you are using the built-in Windows telnet client, do:

1. Start, Run, telnet

2. At the Microsoft Telnet prompt, type in

set localecho

3. Then

quit

Now try using telnet again.

Share this post


Link to post
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
Sign in to follow this  

×