Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sending e-mail from command line?

Featured Replies

Hello everybody,

I am trying to send an e-mail without using outlook, I use command lines. The thing is I am new to this and I don't know how to send an e-mail. I can compose one like this:

START mailto:test@test.com?subject=subject^&body=text

One can use this statement in a .bat-file, for example:

@echo off
START mailto:test@test.com?subject=subject^&body=text

I hope somebody can help me??

I know there are commercial software who can handle the job, but I want to do it myself or freeware...

Thanks in advance!

Remco

  • 2 months later...

You can use the source code found here to do it, but you must have some programming knowledge and VS.Net to compile it.

I hope this helps.

  • 7 months later...

Funny I read this thread and had a nother browser window/tab open to that very same topic I stumbled upon earlier this evening/morning...

Check out this thread How do I send e-mail from KiXtart? (SMTP) .

Before you say... but I said the COMMAND LINE.... Note they mention several techniques, including Blat

I've never used either one, so I can't help you beyond directing you to that post and site.

(edit) Just re-read your post. Did you want to open up a new message so the user can type stuff before sending, or did you just want to send a message via the command line with no user interaction?

Edited by JoeMSFN

I got two scripts for this purposes:

First one is using actual Outlook configuration

Option Explicit

Dim objOutlook, objNameSpace, objMail
Dim strAddress, strSubject, strBody, strMailItem

strAddress = "martin.zugec@gmail.com"
strSubject = "Test"
strBody = "Automating send test"

Set objOutlook = WScript.CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.getNamespace("MAPI")
Set objMail = objOutlook.CreateItem(strMailItem)

objMail.Subject = strSubject
objMail.Body = strBody
objMail.RecipIents.Add(strAddress)
objMail.Send

SET objOutlook = nothing
SET objNameSpace = nothing
SET objMail = nothing

Second one is using SMTP, so it is Outlook-independent.

Option Explicit

Dim objEmail, objNetwork
Dim strComputerName

Set objEmail = CreateObject("CDO.Message")
Set objNetwork = CreateObject("Wscript.Network")

strComputerName = objNetwork.ComputerName

With objEmail
  .From =  strComputerName & "@domain.com"
  .To = "martin.zugec@gmail.com"
  .Subject = "Test"
  .Textbody = "Testing mail delivery"
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "pred-hub.pre.cz"
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  .Configuration.Fields.Update
  .Send
End With

Set objEmail = Nothing
Set objNetwork = Nothing

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.