Jump to content
Sign in to follow this  
Jac

SMTP email

Recommended Posts

Jac

Hi im trying to use autoit to send email with our smtp server. My pc is authorize to send email with the server and i tested it with this software "MultiMail2" and it's working just fine but not with autoit

Here is the code

$s_SmtpServer = "192.168.x.x"

$s_FromName = "TEST"

$s_FromAddress = "test@domainname.qc.ca"

$s_ToAddress = "test@domainname.qc.ca"

$s_Subject = "test"

Dim $as_Body[2]

$as_Body[0] = "The file " & $FileName & " is out of date"

$as_Body[1] = "Second Line"

$Resultat = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)

$err = @error

If $Resultat = 1 Then

MsgBox(0, "Success!", "Mail sent")

Else

MsgBox(0, "Error!", "Mail failed with error code " & $err)

EndIf

I always received error code "Mail failed with error code 50"

Any help please

Thanks !

Share this post


Link to post
Share on other sites
SpookMeister

Look at the $s_first parameter for _INetSmtpMail(). I found that my mail server required the -1 value that the help file mentioned.

$s_SmtpServer = "192.168.x.x"
$s_FromName = "TEST"
$s_FromAddress = "test@domainname.qc.ca"
$s_ToAddress = "test@domainname.qc.ca"
$s_Subject = "test"
Dim $as_Body[2]
$as_Body[0] = "The file " & $FileName & " is out of date"
$as_Body[1] = "Second Line"
$Resultat = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ComputerName, -1)
$err = @error

If $Resultat = 1 Then
MsgBox(0, "Success!", "Mail sent")
Else
MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites
Jac

Thanks it worked !

Look at the $s_first parameter for _INetSmtpMail(). I found that my mail server required the -1 value that the help file mentioned.

$s_SmtpServer = "192.168.x.x"
$s_FromName = "TEST"
$s_FromAddress = "test@domainname.qc.ca"
$s_ToAddress = "test@domainname.qc.ca"
$s_Subject = "test"
Dim $as_Body[2]
$as_Body[0] = "The file " & $FileName & " is out of date"
$as_Body[1] = "Second Line"
$Resultat = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ComputerName, -1)
$err = @error

If $Resultat = 1 Then
MsgBox(0, "Success!", "Mail sent")
Else
MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

Share this post


Link to post
Share on other sites
BJJ

Can u put full code for send email ??

Share this post


Link to post
Share on other sites
Minikori

Can u put full code for send email ??

You might want to take a look at this.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites
BrettF

Erm may I ask why that matters? this is a support topic, and I think hes asking for the correct result...

In that case he should use the infamous search feature...

Cheers,

Brett

Share this post


Link to post
Share on other sites
Minikori

Erm may I ask why that matters? this is a support topic, and I think hes asking for the correct result...

In that case he should use the infamous search feature...

Cheers,

Brett

Yeah, I guess your right.

@Quzziy: I use to have this Email GUI I got from the example scripts section, but I just searched and couldn't find it.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites
CodyBarrett

You might want to take a look at this.

uhhh just incase you didnt notice (if your warning him that is) he never actually DID say whether or not the source was 'not for our eyes' so yeah....

Edited by CodyBarrett

Share this post


Link to post
Share on other sites
BrettF
CodyBarrett

because i was researching this function for myself.... and this overreaction\missunderstanding was bugging me :\

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  

×