pieeater Posted June 14, 2011 Share Posted June 14, 2011 (edited) im trying to create a help forum which will prompt the user to add a description of there problem and when the user hits submit it will email me the description to an defined email, however i'm having some problems figuring out how to get the email working, i've tried it using a function jos made for emailing, i can't figure it out. i'm pretty new to inet functions, but here is what i've tried so far:expandcollapse popup#Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Help Forum", 591, 174, 319, 125) $Name = GUICtrlCreateInput("", 24, 32, 140, 21) $Time1 = GUICtrlCreateInput("", 24, 88, 140, 21, BitOR($ES_AUTOHSCROLL, $ES_READONLY)) $Email1 = GUICtrlCreateInput("", 24, 144, 140, 21) $Name1 = GUICtrlCreateLabel("Name", 24, 8, 32, 17) $Time2 = GUICtrlCreateLabel("Time", 24, 64, 27, 17) $Email2 = GUICtrlCreateLabel("Email (Optional)", 24, 120, 77, 17) $Discription = GUICtrlCreateLabel("Discription of problem", 168, 8, 105, 17) $Edit2 = GUICtrlCreateEdit("", 168, 32, 417, 137) $Checkbox1 = GUICtrlCreateCheckbox("Urgent (if checked email required)", 408, 8, 177, 17) $Submit = GUICtrlCreateButton("Submit", 304, 5, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 GUICtrlSetData($Time1, @YEAR & "/" & @MON & "/" & @MDAY & "/" & @HOUR & "/" & @MIN & "/" & @SEC & "/" & @MSEC) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Submit If $Checkbox1 = $GUI_CHECKED Then If GUICtrlRead($Email1) = "" Then MsgBox(0, "Error", "Email must not be blank with urgent checked!") GUIDelete($Form2) Exit EndIf $email = GUICtrlRead($Email1) $problem = GUICtrlRead($Edit2) $time = GUICtrlRead($Time1) Local $i = _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Name), "icenut123@gmail.com", "sndmsghere@gmail.com", "Problem with Balance Calculator", GUICtrlRead($Time1) & @LF & GUICtrlRead($Email1) & @LF & "message starts here_____________________________________________________" & @LF & GUICtrlRead($Edit1), "", "", "Normal") If $i = 1 Then ConsoleWrite("win") ConsoleWrite(@error) Else $email = GUICtrlRead($Email1) $problem = GUICtrlRead($Edit2) $time = GUICtrlRead($Time1) Local $i = _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Name), "icenut123@gmail.com", "sndmsghere@gmail.com", "Problem with Balance Calculator", GUICtrlRead($Time1) & @LF & GUICtrlRead($email) & @LF & "message starts here_____________________________________________________" & @LF & GUICtrlRead($Edit1), "", "", "Normal") If $i = 1 Then ConsoleWrite("win") ConsoleWrite(@error) EndIf GUIDelete($Form2) EndSwitch WEnd Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $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.Bcc = $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]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) 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 If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;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 If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" 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 ;==>MyErrFuncalso i cant be sure that the person using it will have a email client so i don't think using _INetMail() will workheres the to jos's functionthanks in advance Edited June 14, 2011 by pieeater [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
JohnOne Posted June 14, 2011 Share Posted June 14, 2011 (edited) You need to add details of your own email , or at least one specifically for purpose. The days of anonymous email are over as I understand. Edited June 14, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
pieeater Posted June 14, 2011 Author Share Posted June 14, 2011 what kind of details? sorry i really dont know much about this kind of thing [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
JohnOne Posted June 14, 2011 Share Posted June 14, 2011 Can you say what exactly you dont understand from this? $SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "your@Email.Address.com" ; address from where the mail should come $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED $Subject = "Userinfo" ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed $BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "******" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; 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 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
pieeater Posted June 14, 2011 Author Share Posted June 14, 2011 oops. sorry i wasnt thinking. thanks johnone [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now