how to read email address from a file and send mail??

A

ambs.tech

Hi all,

Is there any way to read a email address from a text file and send
email to that address using C language. any hint or any code regarding
this will be very helpful.

Thanks,

Ambika
 
K

Keith Thompson

Is there any way to read a email address from a text file and send
email to that address using C language. any hint or any code regarding
this will be very helpful.

Not portably. The best approach is probably to invoke some external
program with appropriate arguments; you can use the system() function
to do this. For details, try a newsgroup specific to your system.
 
D

Dave Vandervies

Hi all,

Is there any way to read a email address from a text file and send
email to that address using C language. any hint or any code regarding
this will be very helpful.

Use fopen and fgets to read lines from the file, and examine the buffer
you're reading into (either by looking at individual characters or
using the strxxx functions in <string.h>) to see whether you got an
email address.

Sending mail requires features not defined by the C standard and is
therefore beyond the scope of comp.lang.c . There's a good chance there
are better tools than C for whatever you're trying to do anyways.

(Unless you're trying to write a massmailing spam program, in which case
you can get better results just by writing the mail to /dev/null, NUL,
or something else not entirely unlike these, whichever is supported by
your OS - aside from that one detail, the entire program can be written
in portable C.)


dave
(maintains a small mailing list with a 5-line shell script)
 
K

Keith Thompson

(Unless you're trying to write a massmailing spam program, in which case
you can get better results just by writing the mail to /dev/null, NUL,
or something else not entirely unlike these, whichever is supported by
your OS - aside from that one detail, the entire program can be written
in portable C.)

If you're trying to write a massmailing spam program, and you plan to
run it only on your own computer, you should write the mail directly
to the raw disk device. That's a much better use for it than all that
formatting and directory information.
 
R

Randy Howard

Hi all,

Is there any way to read a email address from a text file and send
email to that address using C language. any hint or any code regarding
this will be very helpful.

It can be done with a shell script quite easily, so it is definitely
doable in C, as long as you don't get too upset over using system()
for some of the less portable aspects.

Since it sounds as if you are trying to write an email spam generator
to get around limits on address list lengths, I doubt that you will
get much more help here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top