Giter VIP home page Giter VIP logo

mailsender's Introduction

mailsender

simple mail-sending service, http-api, written in golang

install

install mail-sender from src

	# get src
	mkdir -p $GOPATH/src/github.com/niean && cd $GOPATH/src/github.com/niean
	git clone [email protected]:niean/mailsender.git && cd mailsender
	
	# build
	go get ./...
	./control build
	
	# config
	mv cfg.example.json cfg.json
	vim cfg.json
	
	# start
	./control start
	...
	
	# stop
	./control stop

install mail-sender from bin

	# get bin
	mkdir -p /home/to/mailsender && cd /home/to/mailsender
	wget https://github.com/niean/mailsender/releases/download/v0.0.1/tycs-mailsender-0.0.1.tar.gz
	tar -zxf tycs-mailsender.tar.gz
	
	# config
	mv cfg.example.json cfg.json
	vim cfg.json
	
	# start
	./control start
	...
	
	# stop
	./control stop

usage

	# test, send one mail to tycloudstart.com:1986
	curl -X POST -d "[email protected];subject=some_subject;content=some_content;user=anddy" "tycloudstart.com:1986/mail/sender"

    # http-api
    POST /mail/sender HTTP/1.1
    Host host:port
    Args
	   -- tos: receivers, separated by comma(,)
	   -- subject: subject of ur mail
	   -- content: content of ur mail
       -- user: optional, displayed name of sender at receiver's side

configuration

    debug: true/false, whether or not open debug-logging

    http
        - enable: true/false, whether or not enable http-server 
        - listen: int, port of the http-server

   	mail 
        - enable: true/false, whether or not enable mail-sending service
        - sendConcurrent: int, max number of concurrent threads sending mails
        - maxQueueSize: int, max number of cached mails which are to be sent
        - fromUser: string, default display name of sender at receiver's side
        - mailServerHost: string, hostname of the smtp (or pop3) server 
        - mailServerPort: int, port of the mailServerHost
        - mailServerAccount: string, authorized user account on mailServerHost
        - mailServerPasswd: int, password for mailServerAccount

debug

use ./test/debug to debug your mailsender service

	bash ./test/debug
	{
	    "data": [
	        {# counter of mailsending request
	            "Cnt": 0,
	            "Name": "HttpRequestCnt",
	            "Other": {},
	            "Qps": 0,
	            "Time": "2015-06-17 09:11:57"
	        },
	        {# counter of all mails sent(ok + error)
	            "Cnt": 0,
	            "Name": "MailSendCnt",
	            "Other": {},
	            "Qps": 0,
	            "Time": "2015-06-17 09:11:57"
	        },
	        {# counter of mails sent ok
	            "Cnt": 0,
	            "Name": "MailSendOkCnt",
	            "Other": {},
	            "Qps": 0,
	            "Time": "2015-06-17 09:11:57"
	        },
	        {# counter of mails sent error
	            "Cnt": 0,
	            "Name": "MailSendErrCnt",
	            "Other": {},
	            "Qps": 0,
	            "Time": "2015-06-17 09:11:57"
	        }
	    ],
	    "msg": "success"
	}

reference

TODO

mailsender's People

Contributors

niean avatar

Watchers

 avatar  avatar

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.