Sending files over internet

Any ideas how to send a file and message within Delphi program to the recipient over the internet so that recipient would be able to read the message and see a file as an attachment in his/her e-mail program.
MalensekAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
PeterLarsenConnect With a Mentor Commented:
Use TNMSMTP.

Regards
Peter
0
 
PeterLarsenCommented:
Like this :

var
 mail : TNMSMTP
begin

mail:=NMSMTP1.create(self); //or just place it on the form
Mail.PostMessage.Subject:='Some text';
Mail.Host:='MailServerName';
Mail.Port:=25;
Mail.UserID:='Your name - not very important';
Mail.PostMessage.FromAddress:='Your mail address';
Mail.PostMessage.FromName:='Your name - not very important';
Mail.PostMessage.ToAddress.Clear;
Mail.PostMessage.ToAddress.Add('E-mail address');
Mail.PostMessage.Attachments.Clear;
Mail.PostMessage.Attachments.Add('a file name');
Mail.PostMessage.Body.Text:='E-mail body - text';
Mail.Connect;
Mail.SendMail;
Mail.Disconnect;

/PL
0
 
RadlerCommented:
Hi Peter,

A help, please. A friend tried use this code and always appear a addtional blank line at the first line of the message body. You with your experience can avoid this ?

T++, Radler.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
rwilson032697Commented:
Listening
0
 
PeterLarsenCommented:
Nice try, Radler  :-)

Well, i dont understand this - i dont get a blank line at the beginning.

I will get back to you later this evening.
0
 
PeterLarsenCommented:
Radler,

This blank line, you'r talking about, is it only there if you have attachments ??

Anyway, i think it will help if you add more lines to the body - like this :

Mail.PostMessage.Body.clear;
Mail.PostMessage.Body.Add('1. line');
Mail.PostMessage.Body.Add('Next line');
Mail.PostMessage.Body.Add('Next line');
Mail.PostMessage.Body.Add('Next line');
Mail.PostMessage.Body.Add('Next line');
Mail.PostMessage.Body.Add('Next line');

or

var
T : string;
begin
 T:='A  line'+chr(13)+chr(10)+chr(13)+chr(10)+chr(13)+chr(10)+chr(13)+chr(10);
 Mail.PostMessage.Body.Text:=T;
.....

Hope this help.
Peter
0
 
RadlerCommented:
I can't answer Peter, I'll ask to my collegue. The first option I guess to him too, and the result was negative. The second is another way, who knows ?
Wait for new comments.

T++, Radler.
0
 
PeterLarsenCommented:
Radler, I would alså like to know what program that receives the mails.
0
 
RadlerCommented:
Sorry, I'll invite my friend to participate from E-E. He can provide this.

T++, Radler.
0
All Courses

From novice to tech pro — start learning today.