View: 3206|Reply: 6
|
Linux : camna nak hantar mail pakai c programming??
[Copy link]
|
|
Post Last Edit by iphone3gs at 24-1-2011 12:49
aku guna c programming tok antar mail. Dah dapat compile file suma tapi bila run takdak mail pon masuk inbox aku. camne ek..ada sapa2 leh tolong tengokkan program aku ni..salah tang mana..pening palaaaaaa
aku compile di unix guna command ni
$ cc -o file file.c -lusb
run pakai ni
./file
pastu dia kuar lagi
$
(aku nak tulis apa lagi ni...?ada command papa lagi ka tuk push dia send mai? kalo ada plis bgtaw)
ni code aku
#include <stdio.h>
#include <stdlib>
/* send mail */
int main() {
FILE *p;
p = popen("/usr/sbin/sendmail -f '[email protected]' -t", "w" ) ;
if (p == NULL) {
fprintf(stderr, "Can't open pipe\n" ) ;
exit(1);
}
/* Set Header */
fprintf(p,
"From: <[email protected]>\n"
"To: <[email protected]>\n"
"Subject: Test mail\n"
"\n" ) ;
/* Set Mail body */
fprintf(p, "This is test mail\n" ) ;
pclose(p);
return 0;
} |
|
|
|
|
|
|
|
aku tak pandai C.. tapi mail server ko dah up ke? kalau dah try check kat email q, |
|
|
|
|
|
|
|
Reply 2# BorderManager
mail server up? camne nak check?
plisss gtaw detaill heee |
|
|
|
|
|
|
|
Reply BorderManager
mail server up? camne nak check?
plisss gtaw detaill heee :lov ...
iphone3gs Post at 24-1-2011 14:39
ko guna linux apa???
kalau redhat/centos/fedora ko type n
[root@localhost ~]# service --status-all | grep sendmail
output mcm n
sendmail (pid 3138) is running...
kalau ubuntu/debian
[root@localhost ~]#ps -e |grep sendmail |
|
|
|
|
|
|
|
oh aku guna debian, ok da settle upenye server sekat jahh
dah bole anta mail yay! alhamdulillah |
|
|
|
|
|
|
|
Reply 4# BorderManager
tima kasihhhhhhhhhh |
|
|
|
|
|
|
| |
|