Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

He was part of my dream, of course -- but then I was part of his dream too. -- Lewis Carroll


comp / comp.lang.tcl / Re: Sending emails through Microsoft 365

SubjectAuthor
* Sending emails through Microsoft 365Jonathan Kelly
+- Re: Sending emails through Microsoft 365Ashok
`- Re: Sending emails through Microsoft 365alexandru

1
Subject: Sending emails through Microsoft 365
From: Jonathan Kelly
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Tue, 12 Nov 2024 20:01 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jonkelly@fastmail.fm (Jonathan Kelly)
Newsgroups: comp.lang.tcl
Subject: Sending emails through Microsoft 365
Date: Wed, 13 Nov 2024 07:01:12 +1100
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vh0c68$1oiar$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Nov 2024 21:01:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="30a0f64833a16bd1b8ee29eb1beae028";
logging-data="1853787"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WJpZHw7v9g2dK/bD7qYTs"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:SkyQ2YPfYthql1iNVxeu6iHiE6w=
Content-Language: en-US
View all headers

Hi,

our application currently sends out emails through our on-premise
exchange server using TCL. We're currently in the process of moving our
email to Microsoft 365, so has anyone managed to send email through M365
using TCL?

Jonathan.

Subject: Re: Sending emails through Microsoft 365
From: Ashok
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 03:13 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: apnmbx-public@yahoo.com (Ashok)
Newsgroups: comp.lang.tcl
Subject: Re: Sending emails through Microsoft 365
Date: Fri, 22 Nov 2024 22:13:52 -0500
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <vhrh9a$1eks0$1@dont-email.me>
References: <vh0c68$1oiar$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Nov 2024 04:13:48 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c2938c21dc2c7567b197b0a6626bd964";
logging-data="1528704"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/262qf4I3WFW2D4cE0GrJK"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:r2co3I2yUepoQD60yTaqjuTdtts=
Content-Language: en-US
In-Reply-To: <vh0c68$1oiar$1@dont-email.me>
View all headers

Perhaps Paul's CAWT Outlook module might help ?
https://www.tcl3d.org/cawt/download/CawtReference-Outlook.html

On 11/12/2024 3:01 PM, Jonathan Kelly wrote:
> Hi,
>
> our application currently sends out emails through our on-premise
> exchange server using TCL. We're currently in the process of moving our
> email to Microsoft 365, so has anyone managed to send email through M365
> using TCL?
>
> Jonathan.

Subject: Re: Sending emails through Microsoft 365
From: alexandru
Newsgroups: comp.lang.tcl
Organization: novaBBS
Date: Sat, 30 Nov 2024 08:06 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.quux.org!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: alexandru.dadalau@meshparts.de (alexandru)
Newsgroups: comp.lang.tcl
Subject: Re: Sending emails through Microsoft 365
Date: Sat, 30 Nov 2024 08:06:25 +0000
Organization: novaBBS
Message-ID: <b81d266722c86c07561c006e76b710d5@www.novabbs.com>
References: <vh0c68$1oiar$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="579654"; mail-complaints-to="usenet@i2pn2.org";
posting-account="l1iAmVox1ke+zLagusfZ24oI+I+AR96kYETQ9qXKFjg";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$TyKgs7K3zzJ/3jqGtMHuI.QDDggekQg.UlHupTqN0qofUt/pIplSu
X-Rslight-Posting-User: 3217083f22f6079e036efa4232d5f9f8b9be6b49
View all headers

If you have Outlook installed on the same machine that sends emails it
very easy with CAWT:

package require cawt
set appId [Outlook Open]
set mailTextId [Outlook CreateHtmlMail $appId [list $EMail] $subject
$body $attachmentList]
Outlook SendMail $mailTextId

You can also use pure Tcl to send mails directly through the mail
server.
This is my code, except for the true mail adress and password:

# This script sends a text/html formated email with a zip or pdf file
attached (optionally)

package require mime
package require smtp

set to [string trim [lindex $argv 0]]
set subject [lindex $argv 1]
set body [lindex $argv 2]
set attachment [lindex $argv 3]
set bcc [string trim [lindex $argv 4]]
set from [string trim [lindex $argv 5]]
set enc [string trim [lindex $argv 6]]
set pass [string trim [lindex $argv 7]]

if {$from==""} {
set from default@domain.com
} if {$enc==""} {
set enc cp1252
} if {$pass==""} {
set pass yourpassword
}

proc sendmail {to subject body {attachment ""} {bcc {}} {from
default@domain.com} {enc cp1252} {pass ""}} {
set opts {}
lappend opts -servers [list smtp.office365.com]
lappend opts -ports [list 587]
lappend opts -usetls 1
lappend opts -username default@domain.com
lappend opts -password yourpassword

lappend opts -header [list "Subject" [mime::word_encode $enc
quoted-printable $subject]]
lappend opts -header [list "From" $from]
lappend opts -header [list "To" $to]
if {[llength $bcc]} {
lappend opts -header [list "Bcc" $bcc]
}
# lappend opts -debug 1
if {$attachment==""} {
set mime_msg [mime::initialize -canonical "text/html" -param [list
charset $enc] -encoding "8bit" -string $body]
} else {
set apptype [string trim [file extension $attachment] .]
set mime_body [mime::initialize -canonical "text/html" -param
[list charset $enc] -encoding "8bit" -string $body]
set mime_zip [mime::initialize -canonical "application/$apptype;
name=\"[file tail $attachment]\"" -file $attachment]
set mime_msg [::mime::initialize -canonical "multipart/mixed"
-parts [concat $mime_body $mime_zip]]
}
smtp::sendmessage $mime_msg {*}$opts -queue false -atleastone false
-usetls true -debug 0
mime::finalize $mime_msg
}

sendmail $to $subject $body $attachment $bcc $from $enc $pass

1

rocksolid light 0.9.8
clearnet tor