Jump to content

_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")
Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

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.

Link to comment
Share on other sites

  • Developers

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.

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

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...