Jump to content

Inet and InetSmtpMail in same program


Borje
 Share

Recommended Posts

Hi

Is that possible to have this 2 includes ( Inet.au3 ) and ( InetSmtpMail.au3 ) in same program

I have try but that not works I am not so familair with Include-once can that be a sulution?

or is it some other way to go?

I work on a program to send mail one that not to open mail client or the another way is to open mail client...

What i want help with is to have this 2 examples in one program, when i try to send mail wirless only open mail client works...

Thanks for all tips from you experts...

Link to comment
Share on other sites

You should be able to include all of the "includes" files that come with AutoIt3.

#include-once goes at the top of any UDF (User-Defined Function) file you make and use, and is already at the top of all the "includes" files that come with AutoIt3. It is only there in case your code is sloppy in that you inadvertantly attempted to include an "included" file more than once in the same script file; it keeps your script from throwing an error if a function or a constant is defined more than once which they cannot be.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

Post your code that is in error, enclosing it with code tags. The code tags button is the tenth button from the left in the edit pane of the forum email program.

I assure you that it is probably a problem with your script, and that there is no problem including several includes files, people do it all the time.

Edit 1: Sorry, I think that InetSmtpMail.au3 is the old version of INet.au3 - don't use InetSmtpMail.au3

Are you using AutoIt version 3.2.10.0 or the new beta?

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

I think I found out what your problem is by reading the Help file:

_INetSmtpMail is a function that is in INet.au3

_INetSmtpMail is not an include file at all:

From the help file:

#include <INet.au3>

_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

Hello I can not have this code to work

I want to have this 2 includes Inet.au3 and InetSmtpMail.au3 to work together..

If I try to use this together I got an error..

If I use one and one that works good but not when I try to use this 2 together..

Why I need this that is for if I use a Mobile wirless connect the InetSmtpMail not works only the InetMail works that is the big problem therefor I need if InetSmtpMail not work to have a choice to swith over to InetMail or vice versa..

here is the code:

#Include <Inet.au3>

$Address = ("emailadress")

$Subject = ("Control")

$Body1 = ("Test 1")

$Body2 = ("Test 2")

_INetMail($address, $subject, $body1 & $body2)

#Include <InetSmtpMail.au3>

$s_SmtpServer = ""

$s_FromName = ""

$s_FromAddress = ""

$s_ToAddress = ""

$s_Subject = "My Test UDF"

Dim $as_Body[2]

$as_Body[0] = "Testing the new email udf"

$as_Body[1] = "Second Line"

$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

Link to comment
Share on other sites

Borje - OK, I believe that you do have two includes files.

If you are using SciTe as your script editor, it has an Console pane that describes any errors.

The errors you have are probably that constants are defined more than once and functions are defined more than once, when both files are included.

You should be able to find "Inet.au3" in this folder:

C:\Program Files\AutoIt3\Include

Find and open for edit both includes files in your text editor. Copy the contents of both and put them in one "include" file named "MyMail.au3" in the same directory as your script. Hit Ctrl-F5 to do a syntax check if you are using SciTe, and open the Console so you can read the errors. That is at the bottom of SciTe - you click and drag it up, but it usualy pops up a little each time you do a syntax check and errors are found.

Then decide which versions of functions to delete:

Global Const $Borje = 43902
Global Const $Borje = 43902
Func Jack()
     ...
EndFunc
Func Jack()
     ...
EndFunc

Delete those and then delete multiple definitions of constants, but make sure you have at least one definition of each constant and one of each function. The "Global Const ..." lines need to be at the top of the include file, right under "#include-once"

Then put these lines at the top of the script that is throwing the errors, in place of those includes lines:

;#include <Inet.au3>
;#include <InetSmtpMail.au3>
#include "MyMail.au3"
Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
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
 Share

  • Recently Browsing   0 members

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