Jump to content

E-Mail Sender ( Gmail )


lifesux
 Share

Recommended Posts

I want to write a script to send e mail.

Where is the error ?

#Include<file.au3>
#include <INet.au3>
#include <GUIConstants.au3>
#include <array.au3>
$SmtpServer = "smtp.gmail.com"          
$FromName = "deneme"                    
$FromAddress = "xxxxxxxx.com"
$ToAddress = "xxxxxxxx.com"  
$Subject = "test"                 
$Body = "test"                          
$AttachFiles = ""                     
$CcAddress = ""   
$BccAddress = ""    
$Importance = "High"                
$Username = "wxxxxxxxxx"                  
$Password = "xxxxxxxxxx"                
$IPPort=465                     
$ssl=1
Link to comment
Share on other sites

Looks to me like you never actually send the mail. You just assign variables that define the contents of the mail.

lol yes :/ So how can i send ???

trying this but not working

_INetSmtpMail($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject & "", $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
Edited by lifesux
Link to comment
Share on other sites

Thanks for everything guys ! Now its work perfect but i have 1 more question about guictrl read. Here is my code :

$SmtpServer = "smtp.gmail.com"
$FromName = "xxx"
$FromAddress = "xxxx"
$ToAddress = "xxxx"
$Subject = "xxxxx"
$Body = ""GUICtrlRead($Input1)","GUICtrlRead($Input2)","GUICtrlRead($Input3)""
$AttachFiles = ""
$CcAddress = ""
$BccAddress = ""
$Importance = "High"
$Username = "xxxx"
$Password = "xxxx"
$IPPort=465
$ssl=1
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  
  Case $Button2
   Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)

Its not working with guictrlread ??? ( at body part )

Thanks for your help...

Link to comment
Share on other sites

  • Developers

What are those double quotes for around the function?

Load the full version of SciTE4AutoIt3 to ensure au3check is ran each time you press F5 which will give you the syntax errors.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

i deleted quotes but its not working :)

Did you do what I suggested?

.. and we are pretty bad in the area of clairvoyance so post your whole script if you want to hear more than a dozen of guesses.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you do what I suggested?

.. and we are pretty bad in the area of clairvoyance so post your whole script if you want to hear more than a dozen of guesses.

yes i do. i pressed f5 and it show where is the error. i know that .

its my full code :

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <file.au3>
#include <INet.au3>
#include <smtp.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("xxxxx", 398, 324, 297, 182)
$Button1 = GUICtrlCreateButton("xxxxx ", 16, 248, 169, 65, $WS_GROUP)
$Button2 = GUICtrlCreateButton("xxxx", 208, 224, 177, 97, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("xxxx", 8, 88, 193, 24)
$Input2 = GUICtrlCreateInput("xxxx", 8, 128, 193, 24)
$Input3 = GUICtrlCreateInput("xxxxx", 8, 160, 193, 24)
$List1 = GUICtrlCreateList("", 8, 192, 193, 22)
GUICtrlSetData(-1, "xxxx")
GUICtrlSetTip(-1, "xxxxx")
$Label1 = GUICtrlCreateLabel("xxxxx", 32, 16, 320, 33)
GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif")
$Pic1 = GUICtrlCreatePic("xxxxx", 216, 64, 153, 145, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$SmtpServer = "smtp.gmail.com"
$FromName = "xxx"
$FromAddress = "xxxx"
$ToAddress = "xxxx"
$Subject = "xxxxxx"
$Body ="GUICtrlRead($Input1)","GUICtrlRead($Input2)","GUICtrlRead($Input3)"
$AttachFiles = ""
$CcAddress = ""
$BccAddress = ""
$Importance = "High"
$Username = "xxx"
$Password = "xxxx"
$IPPort=465
$ssl=1
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
  
  Case $Button2
   Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
  Case $List1
EndSwitch
WEnd
Link to comment
Share on other sites

  • Developers

Still see the double quotes around the GuiCtrlRead() function so that means it is just treated as a literal string.

When you want to concatenate the 3 input boxes then it should read:

$Body = GUICtrlRead($Input1) &GUICtrlRead($Input2) & GUICtrlRead($Input3)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Still see the double quotes around the GuiCtrlRead() function so that means it is just treated as a literal string.

When you want to concatenate the 3 input boxes then it should read:

$Body = GUICtrlRead($Input1) &GUICtrlRead($Input2) & GUICtrlRead($Input3)

thanks it read but not i want. it send the xxxx not the thing the user write ???

Link to comment
Share on other sites

  • Developers

thanks it read but not i want. it send the xxxx not the thing the user write ???

Yea ... I understand it does that. It would be helpfuff went you try to understand what your are doing in stead of simply posting each and every problem you have.

You need to fill the $Body field with the GUICtrlRead() commands AFTER they are filled in and just BEFORE you send the email.

Again, try to understand the code.

What are you going to use this code for?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yea ... I understand it does that. It would be helpfuff went you try to understand what your are doing in stead of simply posting each and every problem you have.

You need to fill the $Body field with the GUICtrlRead() commands AFTER they are filled in and just BEFORE you send the email.

Again, try to understand the code.

What are you going to use this code for?

Jos

So, how can i do that :) Sorry for my questions but i am new ;)

Edited by lifesux
Link to comment
Share on other sites

What are you going to use this code for?

:)

In my opinion, automating the sending of emails is a dodgy subject and one that ranks up there with the automation of websites.

Besides: Google's GMAIL terms of use:

5. Use of the Services by you

5.3 You agree not to access (or attempt to access) any of the Services by any means other than through the interface that is provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google. You specifically agree not to access (or attempt to access) any of the Services through any automated means (including use of scripts or web crawlers) and shall ensure that you comply with the instructions set out in any robots.txt file present on the Services.

Expressly forbids the use of scripts to automate email through their service.

Edited by Blue_Drache

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

Link to comment
Share on other sites

  • Developers

So, how can i do that :) Sorry for my questions but i am new ;)

Again.. learn to script/program first, else this tools is going to hurt more then it helps you.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...