-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
291 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# Mailer | ||
# [Mailer](http://diev.github.io/Mailer/) | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/ukoqyhda8b706p02/branch/master?svg=true)](https://ci.appveyor.com/project/diev/mailer/branch/master) | ||
|
||
A simple console email sender to send reports from batch files without any configs. | ||
A simple console email sender to send reports from batch files without | ||
any configs. | ||
|
||
## Make | ||
Just compile with your target .NET (2.0, 3.5, 4.0+) on your Windows by its bundled C# compiler: | ||
|
||
Just compile with your target .NET (2.0, 3.5, 4.0+) on your Windows by | ||
its bundled C# compiler: | ||
|
||
``` | ||
C:\Windows\Microsoft.NET\Framework\...\scs.exe /out:Mailer.exe /recurse:*.cs | ||
``` | ||
|
@@ -13,35 +18,44 @@ Use enclosed simple *make.cmd* with preset paths for these .NET. | |
Of course you can use MSBuild itself. | ||
|
||
## Usage | ||
|
||
Run without arguments (or with '?' in any place) to get help. | ||
|
||
``` | ||
Mailer.exe ? | ||
``` | ||
|
||
Use at least one argument in such order: | ||
|
||
``` | ||
Mailer to subject body attach | ||
``` | ||
|
||
If instead *to* is '-', it will be used the parameter from source (see *Parameters.cs* below). | ||
You can write a few recipients separated by ',' (or ';', they will be properly replaced). | ||
If instead *to* is '-', it will be used the parameter from source | ||
(see *Parameters.cs* below). You can write a few recipients separated | ||
by ',' (or ';', they will be properly replaced). | ||
|
||
If *subject* or *body* starts with: | ||
* '-' take content from a file in *DOS 866* | ||
* '=' take content from a file in *Windows 1251* | ||
* '\*' take content from a file in *UTF-8* | ||
|
||
Additionally after *subject* ':' you can specify a number of line in that file (from top or bottom, if negative). Default is 1 (the first line from top of file). | ||
Additionally after *subject* ':' you can specify a number of line in that | ||
file (from top or bottom, if negative). Default is 1 (the first line from | ||
top of file). | ||
|
||
Same after *body* you can specify a number of lines of that file (from top or bottom, if negative). Default is 0 - entire file. | ||
Same after *body* you can specify a number of lines of that file (from top | ||
or bottom, if negative). Default is 0 - entire file. | ||
|
||
In *attach* you can specify a few filenames separated by ',' and ';' (it is adjustable - see *Parameters.ps* below). | ||
In *attach* you can specify a few filenames separated by ',' and ';' | ||
(it is adjustable - see *Parameters.ps* below). | ||
|
||
If an argument contains spaces, it must be enclosed with quotes "". | ||
|
||
If no arguments or there is '?' somewhere, it will be shown this Usage text. | ||
|
||
## Examples | ||
|
||
``` | ||
Mailer [email protected] Test | ||
Mailer [email protected],[email protected],[email protected] Test Body-text | ||
|
@@ -61,6 +75,7 @@ Mailer - "Just files" "" "Report 2016.xlsm, My Doc.docx" | |
``` | ||
|
||
## Exit codes for ERRORLEVEL | ||
|
||
(They still can be changed during the further development.) | ||
|
||
* 0 - Normal | ||
|
@@ -70,6 +85,7 @@ Mailer - "Just files" "" "Report 2016.xlsm, My Doc.docx" | |
* 4 - File not found | ||
|
||
## Parameters.cs | ||
|
||
```cs | ||
// The email server's IP or DNS host name. | ||
const string HOST = "192.168.0.1"; | ||
|
@@ -83,7 +99,8 @@ const bool SSL = false; | |
// A username to login into the email server. | ||
const string USER = "[email protected]"; | ||
|
||
// A password encoded in Base64 to login into the email server. Do not store any passwords as a plain text! | ||
// A password encoded in Base64 to login into the email server. | ||
// Do not store any passwords as a plain text! | ||
const string PASS = "c2VuZGVy"; | ||
|
||
// Emails of recipients by default. Maybe separated by ',' or ';' signs. | ||
|
@@ -92,9 +109,11 @@ const string TO = "[email protected]"; | |
// An array of chars to be list separators for attached filenames. | ||
const string LIST = ",;"; | ||
|
||
// An array of signatures to read files in the proper encoding: -DOS 866 (0), =Windows 1251 (1), *UTF8 (2). | ||
// An array of signatures to read files in the proper encoding: | ||
// -DOS 866 (0), =Windows 1251 (1), *UTF8 (2). | ||
const string MODE = "-=*"; // DOS 866, Windows 1251, UTF8 | ||
``` | ||
|
||
## License | ||
Licensed under the Apache [License](LICENSE), Version 2.0. | ||
|
||
Licensed under the Apache [License-2.0](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
version: '{build}' | ||
pull_requests: | ||
do_not_increment_build_number: true | ||
branches: | ||
only: | ||
- master | ||
skip_tags: true | ||
skip_branch_with_pr: true | ||
max_jobs: 1 | ||
configuration: Release | ||
init: | ||
- cmd: git config --global core.autocrlf input | ||
assembly_info: | ||
patch: true | ||
file: '**\AssemblyInfo.*' | ||
assembly_version: '{version}' | ||
assembly_file_version: '{version}' | ||
assembly_informational_version: '{version}' | ||
install: | ||
- ps: >- | ||
$AssemblyFile = "AssemblyInfo.cs" | ||
$RegularExpression = [regex] '^\[assembly: AssemblyFileVersion\(\"(\d*\.\d*)\.\d*\.\d*\"\)\]$' | ||
$FileContent = Get-Content $AssemblyFile | ||
foreach($content in $FileContent) { | ||
$match = [System.Text.RegularExpressions.Regex]::Match($content, $RegularExpression) | ||
if($match.Success) { | ||
$ver = $match.groups[1].value | ||
break; | ||
} | ||
} | ||
Update-AppveyorBuild -Version ("{0}.{1}" -f $ver, $env:APPVEYOR_BUILD_NUMBER) | ||
$CommitDateTime = [datetime]::Parse($env:APPVEYOR_REPO_COMMIT_TIMESTAMP) | ||
$env:BuildDate = $CommitDateTime.AddHours(3).ToString('dd.MM.yyyy') | ||
Write-Host "Building v$env:APPVEYOR_BUILD_VERSION dated $env:BuildDate" | ||
build_script: | ||
- cmd: >- | ||
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc /out:%APPVEYOR_PROJECT_NAME%.exe /recurse:*.cs | ||
echo %APPVEYOR_PROJECT_NAME% v%APPVEYOR_BUILD_VERSION% (%BUILDDATE%) >readme.txt | ||
echo http://%APPVEYOR_ACCOUNT_NAME%.github.io/%APPVEYOR_PROJECT_NAME% >>readme.txt | ||
7z a %APPVEYOR_PROJECT_NAME%-v%APPVEYOR_BUILD_VERSION%.zip *.exe readme.txt | ||
artifacts: | ||
- path: '*.zip' | ||
name: AppZip | ||
deploy: | ||
- provider: GitHub | ||
tag: v$(appveyor_build_version) | ||
release: $(appveyor_project_name) v$(appveyor_build_version) | ||
description: '* $(appveyor_repo_commit_message)\n\nBuild #$(appveyor_build_number) by AppVeyor $(BuildDate)\nSee docs on http://$(appveyor_account_name).github.io/$(appveyor_project_name)' | ||
auth_token: | ||
secure: CePfctnBFd3iDwgVWlGOD6mfxQZrNBHK7IpsCK/deo2vHxA3lTr2nRnhbqpKqchQ | ||
artifact: AppZip | ||
draft: false | ||
prerelease: true | ||
force_update: true | ||
on: | ||
branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-midnight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE html> | ||
<html lang="{{ page.lang | default: site.lang | default: "ru" }}"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="chrome=1"> | ||
<title>{{ site.title | default: site.github.repository_name }} by {{ site.github.owner_name }}</title> | ||
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> | ||
<!--favicon--> | ||
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"> | ||
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"> | ||
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"> | ||
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"> | ||
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"> | ||
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"> | ||
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"> | ||
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"> | ||
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> | ||
<link rel="manifest" href="/manifest.json"> | ||
<meta name="msapplication-TileColor" content="#ffffff"> | ||
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png"> | ||
<meta name="theme-color" content="#ffffff"> | ||
<!--/favicon--> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
<script src="{{ '/assets/js/respond.js' | relative_url }}"></script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<!--[if lt IE 8]> | ||
<link rel="stylesheet" href="{{ '/assets/css/ie.css' | relative_url }}"> | ||
<![endif]--> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
</head> | ||
<body> | ||
<div class="wrapper"> | ||
<section style="margin-top: 20px;"> | ||
{% if site.github.is_user_page %} | ||
{{ content }} | ||
{% endif %} | ||
{% if site.github.is_project_page %} | ||
<div id="title"> | ||
<h1>{{ site.title | default: site.github.repository_name }}</h1> | ||
<p>{{ site.description | default: site.github.project_tagline }}</p> | ||
<hr> | ||
<span class="credits left">Project by <a href="/">Dmitrii Evdokimov</a></span> | ||
<span class="credits right">Hosted on GitHub: | ||
<a href="{{ site.github.repository_url }}">View</a> | | ||
<a href="{{ site.github.releases_url }}">Downloads</a> | ||
</span> | ||
</div> | ||
{{ content }} | ||
{% endif %} | ||
</section> | ||
</div> | ||
{% if site.google_analytics %} | ||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
try { | ||
var pageTracker = _gat._getTracker("{{ site.google_analytics }}"); | ||
pageTracker._trackPageview(); | ||
} catch(err) {} | ||
</script> | ||
{% endif %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Mailer | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/ukoqyhda8b706p02/branch/master?svg=true)](https://ci.appveyor.com/project/diev/mailer/branch/master) | ||
|
||
A simple console email sender to send reports from batch files without | ||
any configs. | ||
|
||
## Make | ||
|
||
Just compile with your target .NET (2.0, 3.5, 4.0+) on your Windows by | ||
its bundled C# compiler: | ||
|
||
``` | ||
C:\Windows\Microsoft.NET\Framework\...\scs.exe /out:Mailer.exe /recurse:*.cs | ||
``` | ||
|
||
Use enclosed simple *make.cmd* with preset paths for these .NET. | ||
Of course you can use MSBuild itself. | ||
|
||
## Usage | ||
|
||
Run without arguments (or with '?' in any place) to get help. | ||
|
||
``` | ||
Mailer.exe ? | ||
``` | ||
|
||
Use at least one argument in such order: | ||
|
||
``` | ||
Mailer to subject body attach | ||
``` | ||
|
||
If instead *to* is '-', it will be used the parameter from source | ||
(see *Parameters.cs* below). You can write a few recipients separated | ||
by ',' (or ';', they will be properly replaced). | ||
|
||
If *subject* or *body* starts with: | ||
* '-' take content from a file in *DOS 866* | ||
* '=' take content from a file in *Windows 1251* | ||
* '\*' take content from a file in *UTF-8* | ||
|
||
Additionally after *subject* ':' you can specify a number of line in that | ||
file (from top or bottom, if negative). Default is 1 (the first line from | ||
top of file). | ||
|
||
Same after *body* you can specify a number of lines of that file (from top | ||
or bottom, if negative). Default is 0 - entire file. | ||
|
||
In *attach* you can specify a few filenames separated by ',' and ';' | ||
(it is adjustable - see *Parameters.ps* below). | ||
|
||
If an argument contains spaces, it must be enclosed with quotes "". | ||
|
||
If no arguments or there is '?' somewhere, it will be shown this Usage text. | ||
|
||
## Examples | ||
|
||
``` | ||
Mailer [email protected] Test | ||
Mailer [email protected],[email protected],[email protected] Test Body-text | ||
Mailer - "Test subject" "Long body text with spaces." | ||
Mailer - "Test DOS file" -filename.txt | ||
Mailer - "Test Win file" =filename.txt | ||
Mailer - "Test UTF file" *filename.txt | ||
Mailer - "Test include" "-Body from DOS 866.txt" | ||
Mailer - "*Subject from UTF-8.txt" "-Body from DOS 866.txt" | ||
Mailer - "Top 10 lines" -c:\filename.txt:10 | ||
Mailer - "Last 5 lines" -c:\filename.txt:-5 | ||
Mailer - report.txt "" report.txt | ||
Mailer - -report.txt:2 "Date in subj, file attached." report.txt | ||
Mailer - =error.log:-1 "Last error in subj!" | ||
Mailer - Files "3 attachments." file1.txt,file2.txt,file3.txt | ||
Mailer - "Just files" "" "Report 2016.xlsm, My Doc.docx" | ||
``` | ||
|
||
## Exit codes for ERRORLEVEL | ||
|
||
(They still can be changed during the further development.) | ||
|
||
* 0 - Normal | ||
* 1 - Email sending was canceled | ||
* 2 - Shown Usage | ||
* 3 - Wrong argument | ||
* 4 - File not found | ||
|
||
## Parameters.cs | ||
|
||
```cs | ||
// The email server's IP or DNS host name. | ||
const string HOST = "192.168.0.1"; | ||
|
||
// The TCP port of SMTP. Default is 25. | ||
const int PORT = 25; | ||
|
||
// Use the secured connection. | ||
const bool SSL = false; | ||
|
||
// A username to login into the email server. | ||
const string USER = "[email protected]"; | ||
|
||
// A password encoded in Base64 to login into the email server. | ||
// Do not store any passwords as a plain text! | ||
const string PASS = "c2VuZGVy"; | ||
|
||
// Emails of recipients by default. Maybe separated by ',' or ';' signs. | ||
const string TO = "[email protected]"; | ||
|
||
// An array of chars to be list separators for attached filenames. | ||
const string LIST = ",;"; | ||
|
||
// An array of signatures to read files in the proper encoding: | ||
// -DOS 866 (0), =Windows 1251 (1), *UTF8 (2). | ||
const string MODE = "-=*"; // DOS 866, Windows 1251, UTF8 | ||
``` | ||
|
||
## License | ||
|
||
Licensed under the [Apache License, | ||
Version 2.0](http://www.apache.org/licenses/LICENSE-2.0 "LICENSE"). |