Jump to content

SOS! Send email with attachment - (Moved)


Recommended Posts

Dear All,

 

Please help to solve the very simple issue with sending the email message with attacment. I have found such code and made it work for out SMTP server. 

Simple mail can be sent, but when I am trying to attache the file, it gives the error 50. 

here is my code : 

 

#include <Inet.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>

$s_SmtpServer = "smtp.services.mail.net"
$s_FromName = "artiom oriol"
$s_FromAddress = "artiom.oriol@mail.com"
$s_ToAddress = "artiom.oriol@mail.com"
$s_Subject = "My Test UDF"
$AttachFiles = "C:\Users\artiom.oriol\Desktop\testFile.txt"
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, $AttachFiles, $as_Body, -1)
$err = @error
If $Response = 1 Then
    MsgBox(0, "Success!", "Mail sent")
Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

 

 

Thank you in advance.

Best regards!

 

Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

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

  • Developers
32 minutes ago, Skeletor said:

@Nine By the way, does this of script Jos guarantee secure connections to SMTP servers.

When the "CDO.message" com object from Microsoft comes with any guarantees then I would say yes, but that is what is used, so you need to search for that when you have any specific questions, as the script is simply a wrapper for that object.  ;)

 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

6 minutes ago, Jos said:

When the "CDO.message" com object from Microsoft comes with any guarantees then I would say yes, but that is what is used, so you need to search for that when you have any specific questions, as the script is simply a wrapper for that object. ;)

Jos

Didn't know.. but now I know... thanks Jos.

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

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