🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

one.leftshift.protoscript:protoscript-smtp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one.leftshift.protoscript:protoscript-smtp

ProtoScript is an open source software library for script based handling of various protocols.

1.5.0
Source
Maven
Version published
Maintainers
1
Source

CircleCI branch GitHub tag (latest SemVer) Maven Central

Protocol Scripts (a.k.a. protoscript)

How to send an email via SMTP (BasicAuth)


        val sessionConfig = { config: SmtpConfig ->
            config.host(host)
            config.port(587)
            config.username(username)
            config.password(XXXXX)
        }

        val spec = smtp(sessionConfig) {
            header(username, "A subject") {
                to("xxxx@leftshift.one")
            }
            content {
                headline("Example smtp")
                text("this is an example smtp string")
            }
            attachment {
                pdf("".toByteArray(), "test")
            }
        }

        val executorService = ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, LinkedBlockingQueue())
        SmtpScript.send(spec, executorService).get()

How to send an email via SMTP (OAuth: Password Flow)

At this moment only the OAuth flow "password" is implemented.


        val sessionConfig = { config: SmtpConfig ->
            config.host(host)
            config.port(587)
            config.authenticator {
                clientId(clientId)
                clientSecret(clientSecret)
                username(username)
                password(password)
                scope(scopes)
                grantType(grantType)
                url(url)
            }
        }


        val spec = smtp(sessionConfig) {
            header(username, "Patricio Trabajador Bearer") {
                to("xxxxxx@leftshift.one")
            }
            content {
                headline("Example smtp")
                text("this is an example smtp string")
            }
            attachment {
                pdf("".toByteArray(), "test")
            }
        }

        val executorService = ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, LinkedBlockingQueue())
        SmtpScript.send(spec, executorService).get()

Development

Release

Releases are triggered locally. Just a tag will be pushed and CI pipelines take care of the rest.

Major

Run ./gradlew final -x sendReleaseEmail -Prelease.scope=major locally.

Minor

Run ./gradlew final -x sendReleaseEmail -Prelease.scope=minor locally.

Patch

Run ./gradlew final -x sendReleaseEmail -Prelease.scope=patch locally.

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts