15.Biz E-mail 전송 APIBiz E-mail 전송 API

Biz E-mail 전송 APIEdit

15.1개요

15.2용어 정의

15.2.1SMTP 서버

메일을 작성해서 보내시면 그 메일은 SMTP 서버로 일단 전송되며, 이 SMTP 서버에서 SENDMAIL 프로그램을 구동하여 해당 메일 주소로 메일을 보내게 됩니다.
바로 이러한 역할을 하는것을 SMTP 서버, 보내는 메일서버, Outgoing mailserver 라고 합니다

15.3선결 조건

EMAIL API를 사용하여 메일 전송하기 위해 아래의 조건이 선결되어야 한다.

15.3.1설정파일

[api]
domain          = test3.nexuscommunity.net
api_port        = 8448
https           = no
cert_password   = D8529C7ED77EA93989E64B4C16CF8767

[email]
smtp_url        = smtp://mail.g2works.kr:587
smtp_username   = monitor@nexus.co.kr
smtp_password   = password
from_mail       = nexus@nexus.co.kr

[thread]
max_client      = 1024

15.4API 스펙

15.4.1Host

15.4.2E-mail 전송 요청

[Request]
[Parameter]

타입

필수

설명

예제

to

text(512)

Y

받을 이메일

"to": "<nexus_to@nexus.co.kr>"

cc

text(512)

N

받을 참조 이메일

"cc": "<nexus_cc@nexus.co.kr>"

subject

text(512)

Y

메일 제목

"subject":"메일 제목입니다."

body

text

N

메일 내용


use_html

boolean

N

body 데이터 html 사용

(Defaullt:true)


[Response]

타입

필수

설명

예제

code

text

Y

응답코드(200인정상/나머지는 오류)


message_id

text

Y

message-id


[Example]
curl  -H "Accept: application/json" -H "Content-type: application/json" -X POST -d \
'{"to":"<tony@nexus.co.kr>","cc":"<kenneth@nexus.co.kr>","subject":"타이틀 입니>다.", "body":"메일 BODY 입니다. n"}' \
 https://jedai.nexuscommunity.net:8443/email/send

[응답]

{ 
 "code": "200",  
 "message_id": "20220719041009.5nG5azdNMK66MuCV6GXi5x" 
}

15.4.3E-mail 전송 요청(파일 첨부)

[Request]
[Parameter]

타입

필수

설명

예제

to

text(512)

Y

받을 이메일

"to": "<nexus_to@nexus.co.kr>"

cc

text(512)

N

받을 참조 이메일

"cc": "<nexus_cc@nexus.co.kr>"

subject

text(512)

Y

메일 제목

"subject":"메일 제목입니다."

body

text

N

메일 내용


use_html

boolean

N

body 데이터 html 사용

(Defaullt:true)


files

array

N

첨부파일(다중 가능)


[Response]

타입

필수

설명

예제

code

text

Y

응답코드(200인정상/나머지는 오류)


message_id

text

Y

message-id


[Example]
curl  -v -H "Expect:" -H "Content-type: multipart/form-data" -X POST  \
 -F 'to="<test@nexus.co.kr>"' \
 -F 'cc="<test@gmail.com>"' \
 -F "subject=타이틀 입니다." \
 -F "body=메일 BODY 입니다." \
 -F "files=@800_400.png" \
 -F "files=@template_create.json" \
 http://127.0.0.1:8449/email/multipart/send

[응답]

{ 
 "code": "200",  
 "message_id": "20220719041009.5nG5azdNMK66MuCV6GXi5x" 
}

15.4.4E-mail 전송 요청(SMTP 인증포함)

[Request]
[Parameter]

타입

필수

설명

예제

smtp_url

text

Y

SMTP 서버

"smtp":"smtp://smtp.naver.com:465"

user

text

Y

SMTP 사용자 이름

"user":"test@nexus.co.kr"

password

text

N

SMTP 암호

"pasword":"test"

ssl

boolean

Y

ssl 사용

"ssl":true

to

text(512)

Y

받을 이메일

"to": "<nexus_to@nexus.co.kr>"

cc

text(512)

N

받을 참조 이메일

"cc": "<nexus_cc1@nexus.co.kr>,<nexus_cc2@nexus.co.kr>,"

bcc

text(512)

N

받을 숨은참조 이메일

"bcc": "<nexus_bcc@nexus.co.kr>"

subject

text(512)

Y

메일 제목

"subject":"메일 제목입니다."

body

text

N

메일 내용


reply_id

text

N

답변 메일일 경우 받은 메일의


Messege-id 를 입력

"replay_id":"3B5560140957@nexus.co.kr"

use_html

boolean

N

body 데이터 html 사용

(Defaullt:true)


[Response]

타입

필수

설명

예제

code

text

Y

응답코드(200인정상/나머지는 오류)


message_id

text

Y

message-id


[Example]
curl  -H "Accept: application/json" -H "Content-type: application/json" -X POST -d \
'{"to":"<tony@nexus.co.kr>","cc":"<kenneth@nexus.co.kr>","subject":"타이틀 입니>다.", "body":"메일 BODY 입니다. n"}' \
 https://jedai.nexuscommunity.net:8443/email/send

[응답]

{ 
 "code": "200",  
 "message_id": "20220719041009.5nG5azdNMK66MuCV6GXi5x" 
}

15.4.5E-mail 전송 요청(SMTP 인증, 파일 첨부)

[Request]
[Parameter]

타입

필수

설명

예제

smtp_url

text

Y

SMTP 서버

"smtp":"smtp://smtp.naver.com:465"

user

text

Y

SMTP 사용자 이름

"test@nexus.co.kr"

password

text

Y

SMTP 암호


ssl

text

Y

ssl 사용

"true" or "false"

to

text(512)

Y

받을 이메일

"<nexus_to@nexus.co.kr>"

cc

text(512)

N

받을 참조 이메일

"<nexus_cc@nexus.co.kr>"

bcc

text(512)

N

숨은참조 이메일

"<nexus_bcc@nexus.co.kr>,<nexus_bcc1@nexus.co.kr>"

subject

text(512)

Y

메일 제목

"메일 제목입니다."

body

text

N

메일 내용


use_html

boolean

N

body 데이터 html 사용

(Defaullt:true)


reply_id

text

N

답변 메일일 경우 받은 메일의

Messege-id 를 입력

"replay_id":"3B5560140957@nexus.co.kr"

files

array

N

첨부파일(다중 가능)


[Response]

타입

필수

설명

예제

code

text

Y

응답코드(200인정상/나머지는 오류)


message_id

text

Y

message-id


[Example]
curl  -v -H "Expect:" -H "Content-type: multipart/form-data" -X POST  \
 -F 'smtp_url="smtp://smtp.naver.com:465"' \
 -F 'user="test@nexus.co.kr"' \
 -F 'password="62402580"' \
 -F "ssl=true" \
 -F 'to="<test@nexus.co.kr>"' \
 -F 'cc="<test@gmail.com>"' \
 -F "subject=타이틀 입니다." \
 -F "body=메일 BODY 입니다." \
 -F "files=@800_400.png" \
 -F "files=@template_create.json" \
 http://127.0.0.1:8449/email/multipart/tenant/send

[응답]

{ 
 "code": "200",  
 "message_id": "20220719041009.5nG5azdNMK66MuCV6GXi5x" 
}

15.4.6코드 정의

code

설명

200

발송 성공

410

[Error] parameter invalid.

411

[Error] parameter invalid.(to)

421

[Error] parameter invalid.(user)

422

[Error] parameter invalid.(smtp_url)

423

[Error] parameter invalid.(password)





500

[Error] Server