GithubHelp home page GithubHelp logo

Comments (7)

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024 1

I'll change behavior to use 25 instead of 587. And add tips on errors.

from mailozaurr.

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

What parameters exactly are you using to send with one and to send with other?

from mailozaurr.

pseudobacon avatar pseudobacon commented on August 25, 2024

With Mailozaurr: Send-EmailMessage -From 'emailaddress' -To 'emailaddress' -Subject 'subject' -SmtpServer 'server' -Attachments "attachmentfilepath"

With Mailkit:

$smtp = New-Object Mailkit.Net.Smtp.SmtpClient
$message = New-Object MimeKit.MimeMessage
$messageBodyBuilder = New-Object MimeKit.BodyBuilder

$message.From.Add("emailaddress")
$message.To.Add("emailaddress")
$message.Subject = 'subject'

$messageBodyBuilder.Attachments.Add("attachmentfilepath") | Out-Null
$message.Body = $messageBodyBuilder.ToMessageBody()

$smtp.Connect('server')
$smtp.Send($Message)
$smtp.Disconnect($true)
$smtp.Dispose()

from mailozaurr.

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

The difference is in a port most likely. The default that I've taken is 587. Otherwise, there's no port defined and I guess it uses 25, and that's what you're looking for assuming no login/pass.

from mailozaurr.

pseudobacon avatar pseudobacon commented on August 25, 2024

image
Actually it does default to 587. If I put -Port 587 at the end it still fails

from mailozaurr.

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

i mean put 25 at the end ... you're using no login/password - 587 by design requires login/password so you're most likely sending email using relay. Therefore you need port 25.

from mailozaurr.

pseudobacon avatar pseudobacon commented on August 25, 2024

Works now! Maybe put a note in the readme to specify the port since the original Send-MailMessage doesn't require it?

from mailozaurr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.