Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Windows Server 2008 Server Core : Automating Email Using sendEmail

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/28/2011 9:15:29 AM
The sendEmail program is interesting because it originally appeared on the Linux platform, not on Windows. Essentially, sendEmail is a Simple Mail Transfer Protocol (SMTP) agent, so you don't have to rely on any external application to use it. You do need an SMTP server, which the send-Email application assumes is on Localhost unless you specify otherwise. Make sure you download the Windows version of the utility at http://caspian.dotconf.net/menu/Software/SendEmail/.

The really interesting feature of this product, though, is that you can use it to send an email to anyone from the command prompt, a batch file, or a script (the Web page makes it appear that you need to use Practical Extraction and Report Language or PERL, which also works of course, but isn't a requirement). Consequently, an administrator who needs to monitor a host of network machines can do so effectively simply by checking email. This utility uses the following syntax:

sendEmail -f ADDRESS [-t ADDRESS [ADDRESS ...]] [-u SUBJECT] [-m
MESSAGE] [-s SERVER[:PORT]] [-a FILE [FILE ...]] [-cc ADDRESS
[ADDRESS ...]] [-bcc ADDRESS [ADDRESS ...]] [-xu USERNAME [-xp
PASSWORD]] [-l LOGFILE] [-v [...]] [-o NAME=VALUE]
sendEmail –help TOPIC

Of these arguments, you must provide the -f command line switch as a minimum. You must also provide at least one recipient using the -t, -cc, or -bcc command line switches. Finally, even though you don't absolutely have to provide it, you should include a message body using the -m or -o command line switches. You can also type the message using the standard input device (STDIN). The following list describes each of the command line arguments.


-f
ADDRESS

Defines the address of the sender. If you're using this utility to report system progress or errors, you can use the user's address and machine name for the address. For example, using an address of "John, Main<[email protected]>" tells you that the user's name is John and that the machine name is Main. You must still provide a return address, which can be your own email address or the user's email address.

NOTE

Newer Windows systems with built-in firewall support might block the sendEmail utility. Unfortunately, you'll just see an odd error message; neither the utility nor Windows will tell you what is really happening to the email. Make sure you set your firewall to allow sendEmail to transmit the message using whatever port you select. The default port for this utility is 25, but you can change the standard port using the -s command line switch.


-t ADDRESS [ADDRESS ...]

Defines one or more addresses to receive the email message. These email addresses appear in the To field of the message. You can also send the email to addresses in the CC field using the -cc command line switch and the BCC field using the -bcc command line switch.


-u
SUBJECT

Defines the message subject. Make sure you place the message subject in quotes when it contains spaces. Any other argument with spaces also requires quotes.


-m
MESSAGE

Defines the message body. The message body can contain anything that you can place in a standard message, including HTML. However, at some point, this utility becomes more cumbersome than helpful for complex messages and you should consider switching to a full-fledged email application.


-s
SERVER [:PORT]

Specifies the SMTP server. Don't include a protocol with the SMTP server argument—include only the full server name such as smtp.myserver.com. The default server is Localhost. You may also specify a port number to use when contacting the server. The default setting is the standard SMTP port of 25.


-a FILE [FILE ...]

Adds one or more file attachments to the email message. You can use this option to send complex test data.


-cc
ADDRESS [ADDRESS
...]

Defines one or more carbon copy recipients. These addresses appear in the CC field of the message.


-bcc ADDRESS [ADDRESS ...]

Defines one or more blind carbon copy recipients. Even though these email addresses receive the message, they won't appear as part of either the To or CC fields. Instead, you'll normally see a default entry, such as Undisclosed-Recipient.


-xu
USERNAME

Specifies the username for SMTP server authentication. You may not require this input with public servers.


-xp
PASSWORD

Specifies the user's password for the SMTP server account. You normally must provide a username with the -xu command line switch to use this option.


-l
LOGFILE

Specifies a log file to use to record email events.


-v [...]

Forces the utility to provide additional information about email events. Use this command line switch multiple times for added verbosity.


-q

Forces the utility to restrict any email event output. The user won't see any messages at the command line. You can use this option to ensure a background process doesn't disturb the user.


-o
NAME=VALUE

Defines special email processing requirements. This book doesn't describe the email header in detail. However, the following list provides a short description of the various properties that this utility makes available.


message-file=
FILE

Specifies the message relies on a file, rather than a standard body, as the means of sending information.


message-header=
EMAIL_HEADER

Defines one or more special headings for the email message.


message-format=raw

Specifies that the utility will send the email using a raw, prebuilt message.


message-charset=
CHARSET

Defines the character set used by the email message.


reply-to=
ADDRESS

Defines the address to use for replies. The default setting uses the address in the From field of the message for replies. This option provides an alternative to the default.


timeout=
SECONDS

Determines how long the utility, servers, and other elements of the mail transfer system wait for a successful email transmission.

You can find a host of Web sites that describe the email message header online. If you want to understand the email process better and the tools required when working with email headers, look at the Tracking E-mail site at http://www.expita.com/header1.html.



—help
TOPIC

Obtains additional help about a particular topic. Even though you can use the /? command line switch to obtain general help, you can obtain a wealth of additional information by using this command line switch. The following list describes the additional topics.


addressing

Explains the various addressing and related options.


message

Explains the message body input and related options.


misc

Contains all of the miscellaneous topics that don't fit under any other heading.


networking

Explains all of the networking options, such as selecting a server using the -s command line switch.


output

Explains the logging and other output options.

Real World Scenario

Considering Multiplatform Requirements

You might not think that a book on the Windows command line would merit much thought about working on other platforms, but it does. Most administrators today don't have the luxury of just working with Windows or any other individual platform for that matter. Most companies now have multiple platforms for various tasks and the use of more than one platform isn't going to change. In fact, the problem promises to become worse, not better, as time progresses, for administrators.

The sendEmail application is a command line utility that just happens to run at the command line on multiple systems. Any time you can find a single software application that runs on multiple platforms, it's a good idea to check it out. Using the same software on multiple platforms means that you can leverage the work you perform on one platform on all of the other platforms as well. You'll reduce errors and the need for complex training in multiple packages. In some cases, you'll even be able to use the applications you create on multiple platforms because the software that your applications access is the same on every platform.

Unfortunately, software that runs on more than one platform is still the exception and not the rule. In addition, most multiplatform software runs on two platforms; software that runs equally well on three or more platforms is rare. Software that runs precisely the same on three or more platforms is even rarer, but it does exist for specific needs. If your network has an odd combination of mainframe, Linux, Windows, and Macintosh, you probably won't find a lot of software to meet your command line needs, but you should still look. When you find someone who has two of your platforms covered, try to convince them to cover the other platforms too. Multiple platform networks are here to stay—any software you can find that runs equally well on all of those platforms makes your job easier.

Other -----------------
- Securing Exchange Server 2010 with ISA Server : Outlining the Inherent Threat in Exchange Server HTTP Traffic
- Securing Exchange Server 2010 with ISA Server : Outlining the Need for ISA Server 2006 in Exchange Server Environments
- Governing the SharePoint 2010 Ecosystem : Governing Site Collections and Sites
- Governing the SharePoint 2010 Ecosystem : Governing the Farm
- Windows Server 2008 R2 : Installation of the Microsoft Hyper-V Role
- Windows Server 2008 R2 : Planning Your Implementation of Hyper-V
- Integration of Hypervisor Technology in Windows Server 2008
- Windows Server 2008 R2 : Understanding Microsoft’s Virtualization Strategy
- SharePoint 2010 PerformancePoint Services : Understanding and Working with KPIs (part 3) - Examining Data Mapping
- SharePoint 2010 PerformancePoint Services : Understanding and Working with KPIs (part 2) - Understanding Multiple Targets and Actuals
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server