Solved

Sending an attachement from C

Posted on 2002-04-18
7
266 Views
Last Modified: 2010-04-16
I need to send an html email with the text file attached from inside C code. The program runs on Linux and uses sendmail. The code that I use is the following:

fprintf(MAIL,"To: %s\n",buy_data.u_email);
fprintf(MAIL,"From: orders@babylon.com\n");
fprintf(MAIL,"Sender: XXXXXXXXXXXXX\n");
fprintf(MAIL,"Subject: XXXXXXXXXXXXXXXXXX\n");
fprintf(MAIL,"Reply-To: XXXXXXXXXXXXXX\n");
fprintf(MAIL,"Return-Path: XXXXXXXXXXXXX\n");
fprintf(MAIL,"Precedence: first-class\n");
fprintf(MAIL,"Mime-Version: 1.0\n");
fprintf(MAIL,"Content-Type: multipart/mixed; boundary=\"theBoundaryString\"\n");
fprintf(MAIL,"\n");
fprintf(MAIL,"--theBoundaryString\n\n");
         
     // print the text email
     fprintf(MAIL,"\n");
         
     fprintf(MAIL,"--theBoundaryString\n");
     fprintf(MAIL,"Content-Type: text/html");

if (strstr(buy_data.lang,"jpn")!=NULL) fprintf(MAIL," ;charset=UTF-8"); // japanese encoding
else fprintf(MAIL," ;charset=iso-8859-1"); // european encoding
fprintf(MAIL,"\n\n");
         
     // print the html email
fprintf(MAIL,"\n");
fprintf(MAIL,"--theBoundaryString--\n\n");
                   
fclose(MAIL);

The above code works for european languages but when I try to send the email in japanese there is no attachement (in Netscape I can see it but no in Outlook). Any ideas why? Am I sending the attachement in a wrong way completely?
0
Comment
Question by:efim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6951415
So you can see the attachment inside the email in Netscape and not in Outlook? This can only mean that the Outlook version you are using does not support japanese attachments.

Have you tried upgrading the program?

CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6951435
Also, it might be the exchange server (if that is the one you use).

CJ
0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6971836
why don't you try out using 'system' call and calling
'uuencode'?

or

you may write all commands in a shell program and call it through 'C' program.

It works for me on DYNIX/PTX. I guess should work on Linux.
See

man uuencode

for more help.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:quirkyquirky
ID: 7299410
0
 

Expert Comment

by:ComTech
ID: 7300662
This person has been suspended for multiple violations of the Member Agreement, and will reject the proposed answer, and return your question to the Active Questions List.  The Moderator Group is deleting all 388 locked questions.

These were posted by three persons:

quirkyquirky
EliteKiller
liloXwin
 
Thank you,
ComTech
CS Admin @ EE
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7515036

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7548103
Question has been closed as per recommendation

JGould-EE Moderator
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question