본문 바로가기

Network

SMTP(Simple Mail Transfer Protocol)

프로그래밍

.NET Framework 클래스 라이브러리

System.Net.Mail.SmtpClient 클래스 - http://msdn.microsoft.com/ko-kr/library/system.net.mail.smtpclient.aspx

C#에서 메일 보내기 (잠김)


보내기

텔넷으로 이메일 보내기



SMTP-AUTH

http://en.wikipedia.org/wiki/SMTP-AUTH

SMTP-AUTH는 인증과정을 포함한 Simple Mail Transfer Protocol (SMTP)의 확장이다. 메일을 보내는 과정 동안에 메일에게 사용자

through which the client effectively logs in to the mail server during the process of sending mail. Servers which support SMTP-AUTH can usually be configured to require clients to use this extension, ensuring the true identity of the sender is known. SMTP-AUTH is defined in RFC 4954.

 

MSMTP E-Mail Client

SMTP client :: msmtp 1.4.16 for Windows 9x/NT/2000/XP on x86 (http://msmtp.sourceforge.net/)
특징
    * Sendmail compatible interface (command line options and exit codes).
    * Authentication methods PLAIN, LOGIN, CRAM-MD5, DIGEST-MD5, GSSAPI, and NTLM.
    * TLS/SSL both in SMTP-over-SSL mode and in STARTTLS mode. Full certificate trust checks can be performed. A client certificate can be sent.
    * Fast SMTP implementation using command pipelining.
    * Support for Internationalized Domain Names (IDN).
    * DSN (Delivery Status Notification) support.
    * RMQS (Remote Message Queue Starting) support (ETRN keyword).
    * IPv6 support.
    * Support for multiple accounts.

CPJNSMTPConnection v2.80 A

PJNSMTPConnection v2.80

CPJNSMTPConnection에는 SocMFC.cpp/h and OpenSSLMfc.cpp/h 모듈이 포함되어 있지 않으므로 별도로 다운을 받아야 함.

CPJNSMTPConnection에 있는 어떤 함수를 호출하기전에 functioning Winsock stack을 인스톨과 초기화를 우선적으로 해야함

애플리케이션을 시작할 때 WSAStartup or AfxSocketInit를 포함

프리컴파일된 헤더들 : afxtempl.h, winsock.h or afxsock.h and afxpriv.h

  1. CPJNSMTPConnection smtp;
    smtp.Connect(_T("mail.someisp.com"));
    CPJNSMTPMessage m;
    m.To.Add(CSMTPAddress(_T("someaddress@somedestination.com")));
    m.m_From = CSMTPAddress("adeveloper@someisp.com");
    m.m_sSubject = _T("A Fellow developer!");
    m.AddTextBody(_T("if you can read this then the CPJNSMTPConnection code is working"));
    smtp.SendMessage(m);

 

NTLM 인증 제공은 : 윈도우의 SSPI 인터페이스들을 통해 제공됨

메시지 전송의 예

 

 

한국 블로그

C로 구현하는 MIME Parser (1)

SMTL를 구현한 소스
CFastSmtp Codproject에 SMTP 프로토콜을 구현한 소스가 있어서 링크한다.
http://www.codeproject.com/KB/IP/zsmtp.aspx

* Visual stuido에서 CMimeMessage와 CSMTPConnection을 사용해서 이베일을 보내는 코드
http://blog.naver.com/websearch/70029502335

* 이메일을 HTML 형식으로 보내는 방법
http://blog.naver.com/websearch/70029576677

 

SMTP Socket Program

SMTP, POP3 code

socket으로 send와 recv

smtp서버와 접속하는 소켓입니다. 그런데 ...

SMTP E-Mail 발송 예제

PHP 간단하게 만들어본 메일전송 클래스 - SMTPSend.php

RFC(Request of Comments)에서 SMTP에 대하여 정의된 대로 통신을 하게 되는데 SMTP에 관련된 RFC를 보면 다음과 같습니다.

① STD 10/RFC 821:두 컴퓨터 사이의 메일 교환 표준을 정의하며 SMTP 자체에 관한 표준으로 TCP/IP 호스트 사이에서 메일을 전달하는데 사용됩니다. rfc0821.txt

② STD 11/RFC 822, RFC1049 : RFC 822와 RFC 1049에 포함된 메일 메시지의 형식에 관한 표준을 정의하며 공식적인 프로토콜명은 MAIL입니다. RFC822는 메일 헤더 필드의 의미를 기술하고 헤더 필드 집합과 그에 대한 해석을 정의합니다.

RFC 1049는 평문 아스키 이외의 문서 형식들이 메일 본문에서 어떻게 사용될 수 있는지에 대해 기술하고 있습니다.

rfc0822.txt  rfc1049.txt

③ RFC 974:DNS(domain name system)을 이용한 메일 경로 배정에 관한 표준을 정의하고 있으며 공식 프로토콜명은 DNS-MX입니다.

 

ATL Server Library Reference

까미유 - VC++ 2005 에서 이메일 보내기 (실제로 작동!!!) - CSMTPConnection.zip

CoInitialize(0); 때문에 작동을 안 했던 것!

CoUninitialize(); 와 짝으로 있다.

찾아보니.. (출처)

CoInitialize는 어떤 객체를 생성하기전 COM library를 초기화하기 위해서 사용

CoUninitialize함수는 객체를 다 사용하고 COM Library를 해제하기 위해서 사용

MSDN에는.. CoInitialize(1) ->CoInitializeEx(2) , CoUninitialize()

 

Send mail without specifying an SMTP server : CSMTPConnection ->CSMTPConnection2 (The Code Project) - (CSMTPConnection2_src.zip)

CSMTPConnection v1.36 - CodeProject

CSMTPConnection Class

Demonstrates the SMTP mail classes provided with ATL Server : Mailer Sample (msdn)

<비교: javamail API vs. ATL Server>

import java.util.Properties;

import javax.mail.Authenticator;

import javax.mail.Message;

import javax.mail.MessagingException;

import javax.mail.Session;

import javax.mail.internet.InternetAddress;

InternetAddress fromAddress = new InternetAddress("sender@domain.com", "Namo", "euc-kr");

InternetAddress[] toAddress = {new InternetAddress("receiver1@domain.com", "recName1", "euc-kr"),
                                           new InternetAddress("receiver2@domain.com", "recName2", "euc-kr")};

import javax.mail.internet.MimeMessage;   ATL::CMimeMessage

MimeMessage msg = new MimeMessage(session);            CMimeMessage msg;

msg.setFrom(fromAddress );                                                msg.SetSender(L"sender@domain.com");

msg.SetSenderName(L"Namo");

msg.setRecipients(Message.RecipientType.TO, toAddress);    msg.AddRecipient(L"receiver@domain.com");

msg.setSubject("JavaMail euc-kr");                                       msg.SetSubject(L"Hello World");

msg.setSentDate(new Date());

msg.setText("Hello, world!\n한글메시지\n","euc-kr");              msg.AddText(L"Hmmm, this should work fine!");

import javax.mail.Transport;                        CSMTPConnection conn (msdn) <- atlsmtpconnection.h

Transport.send(msg);                        conn.SendMessage(msg)

Code Page Identifiers

 

Send Email with SSL and ESMTP Authentication support

Email Visual C++ Examples

 

Telnet

SMTP Protocol ( death and the compass)

SMTP Server

Free SMTP Server

 

smtp.c

smtp.c http://www.koders.com/?s=smtp+server&la=*&li=* (리뷰 중)

Windows Mail (formerly Outlook Express)

Windows Mail Messaging API (꿈을 먹고 사는 아이 블로그)

Outlook Express 흉내내보기 #01

msoeapi.h 가 없다는 메시지가 나온다.

'msoeapi.h': No such file or directory

 

Windows Mail (formerly Outlook Express)

Windows Mail Programming Examples

 

다 읽으면 자폭(?)하는 Privnote로 메시지 보내기

 

Sending EMail from within a C++ program - How is it done?

http://www.codeguru.com/forum/showthread.php?t=300530 (sendmail.zip)

Send Email using MAPI - A COM  Email DLL Component, VC++ Example With Source Code ( Email_src.zip Email_demo.zip)

Email Visual C++ Examples (link)

 

E-Mail send function compatible with SMTP auth (forum link)

http://paulownia.egloos.com/3863292

[PHP] SMTP를 이용해서 메일을 보내보자!

인증을 할 때 id와 password는 Base64 인코딩을 해야 했다.

ATL Server Library Reference  - Base64Encode  (Visual Studio에서 제공하는 ATL 라이브러리를 이용했다)

사용하는 함수의 형태는

inline BOOL Base64Encode(
const BYTE* pbSrcData,
int nSrcLen,
LPSTR szDest,
int* pnDestLen,
DWORD dwFlags = ATL_BASE64_FLAG_NONE
) throw( );

joinC 위키 - Base64 인코딩

 

emailman 

Sending e-mail using the Win32 API?

Google Groups

 

Pivo SMTP Component 1.01

 

VB 메일 수신

고수닷컴

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_managing_event_bindings.asp

Visual Basic 스크립트에서 보내는 SMTP 메시지에 부인 추가/