Jump to content
Sign in to follow this  
se7en

Email???

Recommended Posts

se7en

Can anyone please tell me how to send email using autoit?

Share this post


Link to post
Share on other sites
PartyPooper

Try adding something like this to your code:

; #FUNCTION# =======================================================================================================================================================
; Name...........: OpenEmail
; Description ...: Opens the default emailer passing to it the subject and body if filled in.
; Syntax.........: OpenEmail([$sSubject, [$sBody]])
; Parameters ....: $sEmail - Email Address
;                  $sSubject - The subject header (optional)
;                  $sBody      The text of the email (optional)
; Requirement(s).: #include <INet.au3> and an email program must be installed for it to be successful
; Return values .:
; Remarks .......:
; Related .......:
; ==================================================================================================================================================================
#include <INet.au3>
Global $sEmail, $sSubject, $sBody
Func OpenEmail($sSubject = "", $sBody = "")
    _INetMail($sEmail, $sSubject, $sBody)
    If @error Then Msgbox(0,'',"FAIL')
    Return
EndFunc   ;==>OpenEmail
Edited by PartyPooper

Share this post


Link to post
Share on other sites
MirnesC2

#include <INet.au3>

$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $body))

(this one didn't seem to work for me)

OR

#include <INet.au3>

$s_SmtpServer = "mysmtpserver.com.au"
$s_FromName = "My Name"
$s_FromAddress = "From eMail Address"
$s_ToAddress = "To eMail Address"
$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

(haven't tried it)

Share this post


Link to post
Share on other sites
se7en

yeah I know this they are on the help, but thanks for your reply guys!

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  

×