#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Enviar correo - Juan A. Villalpando", 588, 431, 192, 132)
$Label1 = GUICtrlCreateLabel("Asunto: ", 32, 32, 51, 20)
$Input1 = GUICtrlCreateInput("Prueba de correo", 104, 24, 449, 24)
$Label2 = GUICtrlCreateLabel("Mensaje; ", 32, 80, 62, 20)
$Edit1 = GUICtrlCreateEdit("", 104, 72, 449, 97)
GUICtrlSetData(-1, "Esto es una prueba de envío")
$Label3 = GUICtrlCreateLabel("Correo: ", 40, 208, 51, 20)
$Input2 = GUICtrlCreateInput("juan7980@yahoo.com", 112, 208, 441, 24)
$Button1 = GUICtrlCreateButton("Enviar correo", 168, 256, 273, 65)
$Label4 = GUICtrlCreateLabel("Label4", 128, 336, 381, 84)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Respuesta=""
While 1
$msg = GuiGetMsg()
$asunto = GUICtrlRead($Input1)
$mensaje = GUICtrlRead($Edit1)
$enviar_a = GUICtrlRead($Input2)
$nombre = "Juan"
$decorreo = "remitente@yahoo.com"
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
; Botón REGISTRAR
Case $msg = $Button1
$datos = "asunto=" & $asunto & "&mensaje=" & $mensaje & "&enviar_a=" & $enviar_a & "&nombre=" & $nombre
enviar()
EndSelect
Wend
Exit
; Enviar
Func enviar()
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://kio4.esy.es/correo_envia.php", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($datos)
; Recibir
$Respuesta = $oHTTP.ResponseText
$Codigo = $oHTTP.Status
Beep(800,500)
GUICtrlSetData($Label4,$Respuesta)
Sleep(2000)
GUICtrlSetData($Label4,"") ; Borra Label4
EndFunc
|