|
Facebook Joinc ±×·ì
Joinc QA »çÀÌÆ®
joinc´Â Firefox¿Í chrome¿¡¼ Å×½ºÆ® Çß½À´Ï´Ù. IE¿¡¼´Â Å×À̺íÀÌ ±úÁö°Å³ª À̹ÌÁö°¡ º¸ÀÌÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. ƯÈ÷ ±¸±Û DocsÀ̹ÌÁöÀÇ °æ¿ì ¿¢¹Úó¸®µÉ ¼ö ÀÖ½À´Ï´Ù.
- Mail
- ¸ÞÀÏ Àü¼ÛÇÔ¼ö
- yundream
- Version 0.2
- 2004/07/10
¼³¸í
sendmailÀ» ÀÌ¿ëÇÑ °£´ÜÇÑ ¸ÞÀÏ ¹ß¼Û ÇÁ·Î±×·¥, ¸Ç³¯ ÇÊ¿äÇÒ ¶§ ¸¶´Ù ÀçÀÛ¼º ÇÏ´Â°Ô Áö°Ü¿öÁ®¼ ÇÊ¿äÇÒ¶§ ±Ü¾î ºÙÀÏ·Á°í ¸¸µé¾úÀ½.
»ç¿ë¹æ¹ý
#include "sendmail.h"
int Mail::Send(char *mailer, char *email, char *header, char *body);
- mailer : ¸ÞÀÏ Àü¼ÛÀ» À§ÇØ »ç¿ëÇÒ SMTP ÇÁ·Î±×·¥
- email : ¸ÞÀÏ ¹ÞÀ» À̸ÞÀÏ ÁÖ¼Ò
- header : »ç¿ëÀÚ Á¤ÀÇ Çì´õ
- body : ¸ÞÀÏ ³»¿ë
class Mail MyMail;
char *header = "From: test_sender@joinc.co.kr\nSubject: ¾È³ç";
char *body = "hello world\nbanga";
MyMail.Send("sendmail -v", "test@joinc.co.kr", header, body);
ÄÚµå
- sendmail.h
#ifndef _SENDMAIL_H_
#define _SENDMAIL_H_
#include <string.h>
#include <unistd.h>
#include <stdio.h>
using namespace std;
class Mail
{
private:
char sendmailcmd[256];
FILE *mfp;
public:
Mail()
{
mfp = NULL;
}
~Mail()
{
}
int Send(char *sender, char *addr ,char *header, char *body);
};
#endif
- sendmail.cc
#include "sendmail.h"
#include <iostream>
int Mail::Send(char *sender, char *addr, char *header, char *body)
{
snprintf(sendmailcmd, 255, "%s %s", sender, addr);
mfp = popen(sendmailcmd, "w");
if (mfp == NULL)
{
perror("sendmail open error");
return 0;
}
fputs(header, mfp);
fputs("\n\n", mfp);
fputs(body, mfp);
if (pclose(mfp) == -1)
{
cout << "send mail error\n" << endl;
return 1;
}
else
cout << "send mail ok\n" << endl;
return 1;
}
|
|