Jump to content
mLipok

SMTP Mailer UDF

Recommended Posts

Hi,

 

i made some additions to the UDF. They may not be perfect, but they seem to work ok for me.

So i decided to upload my version here, just in case someone might need this:

 

Quote

>>>>> 2019/07/05 -> smiley
    - beware: script breaking changes
    - New: Function: _SMTP_LoadMessageFromFile - smiley
    - Added: _SMTP_SendEmail: $s_EMLPath_LoadFrom file with prepared email (overrides many other settings)
    - Added: _SMTP_SendEmail: Missing paramter info in Header for $s_EMLPath_SaveBefore and $s_EMLPath_SaveAfter and also added the _ to be more consistent with varibale names
    - Changed: _SMTP_SendEmail: $b_IsHTMLBody changed to $i_IsHTMLBody to enable HTML Autodected (0=txt, 1=html, anything else AutoDetect)
    - Added _SMTP_SendEmail: $i_SMTP_timeout to set smtp timout (the script loses mails when sending many mails fast. Setting this to 15 fixes this for me)
    - Changed: _SMTP_SendEmail: $s_Importance now in english and german and sets more header values
    - Added: _SMTP_SendEmail: $s_NotificationAdress and only add if adress is given
    - Added: _SMTP_SendEmail: $s_ReplyToAdress parameter
    - Added: _SMTP_SendEmail: $b_donotsend for testrun or to save the eamil to file without sending
    - Added: _SMTP_SendEmail: we set $oEmail.BodyPart.CharSet = "UTF-8" and $oEmail.BodyPart.ContentTransferEncoding = "quoted-printable"
    - Added: _SMTP_SendEmail: all attached files are now set to base64 encoding

SmtpMailerExample.au3 SmtpMailer.au3

Share this post


Link to post
Share on other sites

Here are some small changes:

Quote

    >>>>> 2019/07/11 -> smiley
    - Added: _SMTP_SendEmail: example in header was incomplete/incorrect
    - Added: _SMTP_SendEmail: info about returnvalue and added return on success
    - Changed: Split examples in two functions
    - Changed: moved several variables to the udf as global vars so we can load and save configs
    - Added: _SMTP_LoadConfig,_SMTP_SaveConfig
    - Changed: when a notification Adress is given and the DSN options are invalid for notification, we autoset valid dsnoptions

smtpmailer.zip

Share this post


Link to post
Share on other sites

@Allow2010,

Don't you think is is somewhat strange to post your own version with changes in somebody's else their thread? 
Either work with the person owning the original script or start your own thread ( to further confuse the hell out of everybody with an third version of my script.   ;) 

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

Share this post


Link to post
Share on other sites

Maybe a simple question:

I have to send mail via a mail server and for this server "EHLO" is required.

So this works well:

_INetSmtpMail($INIsmpt, $INIfromname, $INIfromaddress, $INItomail, $INImailsubject, $report, "EHLO " & @ComputerName, "-1")

But I have also to include attachments, and I don't figure out where to PUT the "EHLO" string in this UDF ...

Any ideas ?

 

Edited by t0nZ

Share this post


Link to post
Share on other sites
3 minutes ago, t0nZ said:

But I have also to include attachments, and I don't figure out where to PUT the "EHLO" string in this UDF ...

Have you simply tried the script posted here or my version to see whether it works?

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

Share this post


Link to post
Share on other sites

I used your script many times when I had to send attachments, normally with Gmail accounts and no problems at all.

But now I have an "open" SMTP company server with no authentication required, no SSL, working only from company LAN but it demands "EHLO" to work.

Tried today also this modified version (searching for maybe a place to insert the "EHLO" parameter) with no success (COM Error !  Number: 80020009   Description:The transport failed to connect to the server)

As stated in my previous post , this ;

Quote

_INetSmtpMail($INIsmpt, $INIfromname, $INIfromaddress, $INItomail, $INImailsubject, $report, "EHLO " & @ComputerName, "-1")

is working, so I guess I have to put somewhere the "EHLO" but dunno where.....

Thanks in advance for your patience...

Edited by t0nZ

Share this post


Link to post
Share on other sites

So again, did you try using my script at all for this as that should work too on a straitforward SMTP server as far as I know given you set the parameters correctly.

Jos

Edited by 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.
  :)

Share this post


Link to post
Share on other sites

Solved!

Tested your original script from this post and it works.

I have to figure out why the modified versions don't work with that "EHLO" server, but for now I'am going with your version.


My sincere thanks.

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By pat4005
      A tiny UDF that can shoot magic packets at your computers to wake them the heck up. All credits to Olish.
      The only parameter it needs to be specified – is your machine's MAC-address (ip address (the second parameter), at which you will be sending magic packet is generating automatically from @IPAddress1 macro)
      Example:
      _WoL_WakeDevice('001CC0CAED7A') ; the second parameter (if necessery) must be a broadcast address of your local network segment (i.e. 192.168.0.255 for a network 192.168.0.0)  
      _WakeOnLan.au3
    • By MrCreatoR
      This UDF allows to create formatted label using pseudo element RichLabel (RichEdit actually). Formating is set by using special modificator similar to <font> tag in Html.
      Notes: This UDF is a transformation-continuation of related UDF


      Example:
      Download:
      GUIRichLabel_1.2.zip
      Small syntax related fix: GUIRichLabel_1.1.zip
      GUIRichLabel_1.1.zip
       
      History version:
    • By Stormgrade
      Hello,
      I'm searching the UDF GDIpProgress.au3 from ProgAndy
      None of the links in topic
       works
      Can't someone upload it please ?
    • By ozymandius257
      This is probably a very simple question (I hope!)
      I'm looking to use a UDF to access a SQL database, and have found ADO.au3, but I can't seem to work out how to use it.
      I've copied the files ado.au3 and ado_constants.au3 into the folder C:\Program Files (x86)\AutoIt3\Include, then opened SciTe and started a new project.
      But when I type #include<AD - I don't get offered ADO.au3.
      (I know I should be using the folder C:\Program Files (x86)\AutoIt3\UserInclude, but when it didn't work from there, I tried the above).
      What am I doing wrong?
       
    • By BetaLeaf
      What is Rollbar?
      Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
      Demo: https://rollbar.com/demo/demo/
      Screenshot:
      Instructions: (RollbarTest.au3)
      ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 
      Right now, it is fully functional but not tested in production.
       
       
      Changelog:
      RollbarSDK.au3
      RollbarTest.au3
      v0.2
       
      v0.1.1
       
×
×
  • Create New...