Jump to content
Sign in to follow this  

_INetSmtpMail not working

Recommended Posts


For some reason I keep getting error code 4

Return Value

Success: Returns 1

Failure: Returns 0 and set @error

@error: 1 - Invalid Parameters

2 - Unable to start TCP

3 - Unable to resolve IP

4 - Unable to create socket

5x - Cannot open SMTP session. x indicates the index number of last command issued to the SMTP server.

50x - Cannot send body. x indicates the line number of $as_Body (first line is 0).

5000 - Cannot close SMTP session

#include <INet.au3>

$s_SmtpServer = "mailhost.worldnet.att.net"
$s_FromName = "ekans"
$s_FromAddress = "EkansAutoitPrograms@yahoo.com"
$s_ToAddress = "EkansAutoitPrograms@yahoo.com"
$s_Subject = "My Test UDF"
Dim $as_Body[2]
$as_Body[0] = "Testing my new"
$as_Body[1] = "EPIC SPAM LOLZ"
$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")
    MsgBox(0, "Error!", "Mail failed with error code " & $err)

Could it be blocked by a firewall or anti virus?

I'm seeing error code 4 in my sleep now its really disturbing......

If you were twice as smart, you'd still be stupid.

Share this post

Link to post
Share on other sites

Are you sure this SMTP server is an OPEN SMTP relay server?

Most providers do not allow to send emails this way when it internet hookup isn't owned by them and the sender Email address isn't an MX domain they own.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.