CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 3206|Reply: 6

Linux : camna nak hantar mail pakai c programming??

[Copy link]
Post time 24-1-2011 12:47 PM | Show all posts |Read mode
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;
}

Reply

Use magic Report


ADVERTISEMENT


Post time 24-1-2011 01:54 PM | Show all posts
aku tak pandai C.. tapi mail server ko dah up ke? kalau dah try check kat email q,
Reply

Use magic Report

 Author| Post time 24-1-2011 02:39 PM | Show all posts
Reply 2# BorderManager


    mail server up? camne nak check?

    plisss gtaw detaill heee
Reply

Use magic Report

Post time 24-1-2011 03:13 PM | Show all posts
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
Reply

Use magic Report

 Author| Post time 24-1-2011 08:06 PM | Show all posts
oh aku guna debian, ok da settle upenye server sekat jahh
dah bole anta mail yay! alhamdulillah  
Reply

Use magic Report

 Author| Post time 24-1-2011 08:18 PM | Show all posts
Reply 4# BorderManager


    tima kasihhhhhhhhhh
Reply

Use magic Report

Follow Us
Post time 25-1-2011 01:46 PM | Show all posts
oh aku guna debian, ok da settle upenye server sekat jahh
dah bole anta mail yay! alhamdulillah  : ...
iphone3gs Post at 24-1-2011 20:06


Debian rasanya default pakai Exim, cuma possibly command "sendmail" tuh boleh pakai

anyway tahniah
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT


Forum Hot Topic

 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

16-12-2024 07:50 PM GMT+8 , Processed in 0.667289 second(s), 19 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list