Jump to content
Sign in to follow this  
roflmao

hapl, get error with inet

Recommended Posts

roflmao

I got a problem with this, i get a error 3 when i use this code i made. @ERROR = 3 - Unable to resolve IP

is it the smtp server or the email-from? i use my ISP smtp server, it works fine if i run "telnet smtp.server.com 25" in cmd

#include <GUIConstants.au3>
#include <INet.au3>

GUICreate("Fake E-Mailer", 300, 500)
GUISetState(@SW_SHOW)

$s_SmtpServer = GUICtrlCreateInput("SMTP Server", 10, 10)
$s_FromName = GUICtrlCreateInput("Name", 10, 40)
$s_FromAddress = GUICtrlCreateInput("Email From", 10, 70)
$s_ToAddress =GUICtrlCreateInput("Email To", 10, 100)
$s_Subject = GUICtrlCreateInput("Subject", 10, 130)
$ButtonSMTPSERVER = GUICtrlCreateButton("?", 220, 10)
$ButtonFROMNAME = GUICtrlCreateButton("?", 220, 40)
$ButtonFROMADDRESS = GUICtrlCreateButton("?", 220, 70)
$ButtonTOADDRESS = GUICtrlCreateButton("?", 220, 100)
$ButtonSubject = GUICtrlCreateButton("?", 220, 130)
$as_Body = GUICtrlCreateEdit("Text", 10, 160, 200, 100)
$ButtonSend = GUICtrlCreateButton("Send", 10, 270, 50, 50)
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $ButtonSMTPSERVER
        MsgBox(0, "Smtp Server", "SMTP server is the default mail server from your Internet Service Provider(ISP). To find your SMTP server, google your isp + SMTP server. You shuld find something like smtp.someISP.com")
    Case $msg = $ButtonFROMNAME
        MsgBox(0, "From Name", "The name of the one you want to send a mail from.")
    Case $msg = $ButtonTOADDRESS
        MsgBox(0, "To address", "The email address you want to send a email to")
    Case $msg = $ButtonSubject
        MsgBox(0, "Subject", "The subject of the mail. Use what ever you want.")
    Case $msg = $ButtonFROMADDRESS
        MsgBox(0, "From Address", "The email address you want to send a mail from, use what ever you want.")
    Case $msg = $ButtonSend
        $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
        $err = @error
        If $Response = 1 Then
            MsgBox(0, "Success!", "Mail sent")
        Else
            MsgBox(0, "Error!", "Mail failed with error code " & $err)
        EndIf
    EndSelect
WEnd

Share this post


Link to post
Share on other sites
Blue_Drache
<_<:)

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
roflmao

Thanks got it working now.. But i still got a small problem, i cant get the text i type to show in the mail. I get a mail but it only got a subject and no text.

#include <GUIConstants.au3>
#include <INet.au3>

GUICreate("Fake E-Mailer", 300, 300)
GUISetState(@SW_SHOW)

$s_SmtpServer = GUICtrlCreateInput("SMTP Server", 10, 10)
$s_FromName = GUICtrlCreateInput("Name", 10, 40)
$s_FromAddress = GUICtrlCreateInput("Email From", 10, 70)
$s_ToAddress = GUICtrlCreateInput("Email To", 10, 100)
$s_Subject = GUICtrlCreateInput("Subject", 10, 130)
$as_Body = GUICtrlCreateInput("Text", 10, 160, 200, 100)
$ButtonSMTPSERVER = GUICtrlCreateButton("?", 220, 10)
$ButtonFROMNAME = GUICtrlCreateButton("?", 220, 40)
$ButtonFROMADDRESS = GUICtrlCreateButton("?", 220, 70)
$ButtonTOADDRESS = GUICtrlCreateButton("?", 220, 100)
$ButtonSubject = GUICtrlCreateButton("?", 220, 130)
$ButtonSend = GUICtrlCreateButton("Send", 10, 265, 200)
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $ButtonSMTPSERVER
        MsgBox(0, "Smtp Server", "SMTP server is the default mail server from your Internet Service Provider(ISP). To find your SMTP server, google your isp + SMTP server. You shuld find something like smtp.someISP.com")
    Case $msg = $ButtonFROMNAME
        MsgBox(0, "From Name", "The name of the one you want to send a mail from.")
    Case $msg = $ButtonTOADDRESS
        MsgBox(0, "To address", "The email address you want to send a email to")
    Case $msg = $ButtonSubject
        MsgBox(0, "Subject", "The subject of the mail. Use what ever you want.")
    Case $msg = $ButtonFROMADDRESS
        MsgBox(0, "From Address", "The email address you want to send a mail from, use what ever you want.")
    Case $msg = $ButtonSend
        $Response = _INetSmtpMail(GUICtrlRead($s_SmtpServer), GUICtrlRead($s_FromName), GUICtrlRead($s_FromAddress), GUICtrlRead($s_ToAddress), GUICtrlRead($s_Subject), GUICtrlRead($as_Body))
        $err = @error
        If $Response = 1 Then
            MsgBox(0, "Success!", "Mail sent")
        Else
            MsgBox(0, "Error!", "Mail failed with error code " & $err)
        EndIf
    EndSelect
WEnd
Edited by roflmao

Share this post


Link to post
Share on other sites
Jos

have you checked the Helpfile for the specifics of that parameter ? <_<

$as_Body [optional] The body of the email as a single dimensional array of strings. Each value in the array will be terminated with a @CRLF in the email.


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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.