Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

e-mail message with client

Posted on 2000-03-18
7
Medium Priority
?
190 Views
Last Modified: 2010-04-04
hi.
i want to send an e-mail message from within my application. i want the folowing:

1.message sobject,body and attachment files are writen by me.

2.message is opened with default e-mail client of user so he only have to put in the adress of his friend and send.

how can i find default e-mail client?
how can i make netscape messenger to open with subject, message body and file attachments that i want?

thanks
ori
0
Comment
Question by:omri_ori
[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
  • 2
  • 2
  • 2
  • +1
7 Comments
 

Expert Comment

by:HamidHossain
ID: 2632757
that was 3 or 4 questions in one !! you should delete it !!.

for sending emails use TNMSMTP component wich comes with delphi 5 at the FastNet tab

you can use this function :

function EmailSend(SMTP: TNMSMTP; iniPath, Subject, ToAddrss, CC, BCC, aBody : String) :Boolean;
var
  MyIni : TIniFile;
begin
  try
    MyIni  := TIniFile.Create(iniPath + 'MyIni.ini');

    with SMTP do begin
      Host   := MyIni.ReadString('Email','Host','');
      Port   := StrToInt(MyIni.ReadString('Email','Port',''));
      UserID := MyIni.ReadString('Email','UserID','');
      Connect;
    end;

    if SMTP.Connected then begin
 
      with SMTP.PostMessage do begin
        FromAddress            := MyIni.ReadString('Email', 'Email','');
        FromName               := MyIni.ReadString('Email', 'Name', '');
        ToAddress.Text         := ToAddrss;
        ToCarbonCopy.Text      := CC;
        ToBlindCarbonCopy.Text := BCC;
        Body.Text              := aBody;
      end;

      SMTP.SendMail;
      Result := True;
    end else begin
      // Error
      Result := False;
    end;
  finally
    MyIni.Free;
  end;
end;

that function reads some info from ini File .. you can replace that with any String.

The best use of that code is to put in a general unit file for multible use with your programs.

Regards,
Hamid
0
 

Author Comment

by:omri_ori
ID: 2633314
thenks for the answer but it is important to me to work with the default mail client of the user.

if he is used to work with netscape messenger i want him to have the message redy in his composer. if he is used to outlook i want the message to open in an outlook mail message window.

thenk you again
ori
0
 
LVL 17

Accepted Solution

by:
inthe earned 300 total points
ID: 2633442
to open in default e-mail client you must use shellexecute() api
the drawback to use shellexecute is you cant add attachment it must be done by user.
to add attachment you must use mapi as above but then it wont open in default email client..

example of shellexecute:

use shellapi;

procedure TForm1.Button1Click(Sender: TObject);
Var
Buffer : String;
recip,subj,mess : String;
begin
recip:= Edit1.text;   {message recipients email address}
subj:=Edit2.Text;     {message subject}
Mess:= Memo1.Text;    {message}
Buffer:='mailto:'+recip+'?subject='+subj+'&body='+mess;
ShellExecute(Application.Handle,'open',PChar(Buffer),nil,nil,SW_Normal);
end;

Regards Barry
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:HamidHossain
ID: 2633461
hmmm Omri,

I think I didnt understand you till now !!

if user check his inbox with outlook he will find the message there .. if he used composer he will find it also !!

so, whats the problem !!

oh, I think you want to create a program wich checking user's inbox.

if that was the case, I think Barry is accespted.

Regards,
Hamid
0
 
LVL 12

Expert Comment

by:Faruk Onder Yerli
ID: 2633510
The unit is running 24 hour 7 day on the my server. Please investigation it.

unit u_ktvform;

interface

uses
  Windows, Messages, SysUtils, Classes, HTTPApp, Psock, NMsmtp, Db,
  DBTables;

type
  TWM = class(TWebModule)
    MailGonder: TNMSMTP;
    TMail: TTable;
    DB1: TDatabase;
    TMailNo: TIntegerField;
    TMailTanimi: TStringField;
    TMailEmail: TStringField;
    TMailKodu: TStringField;
    procedure WMWebAction1Action(Sender: TObject; Request: TWebRequest;
      Response: TWebResponse; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  WM: TWM;

implementation

{$R *.DFM}

procedure TWM.WMWebAction1Action(Sender: TObject; Request: TWebRequest;
  Response: TWebResponse; var Handled: Boolean);
var
  Dongu : integer;
begin
  DB1.Open;
  TMail.Open;

  MailGonder.PostMessage.Body.Add('<strong>KabloTv Baþvurusu');
  MailGonder.PostMessage.Body.Add('KabloTv Baþvuru Tarihi :' + DateToStr(Date));
  MailGonder.PostMessage.Body.Add('IP No :' + Request.RemoteAddr);
  MailGonder.PostMessage.Body.Add('<hr><br>Ýstek Sahibinin Kimlik Belgesi </strong><br><br>');

  Response.Content :=Response.Content + '<br><strong>KabloTv Baþvurusu '+
                                        '<br>KabloTv Baþvuru Tarihi :' + DateToStr(Date)+
                                        '<br>IP No :' + Request.RemoteAddr+
                                        '<br><hr>';

  Response.Content :=Response.Content + '<hr><br>Ýstek Sahibinin Kimlik Belgesi </strong><br><br>';

  for dongu := 1 to 37 do begin
    if dongu = 19 then begin
      Response.Content :=Response.Content + '<hr><br><strong>Tesis Adresi </strong><br><br>';
      MailGonder.PostMessage.Body.Add('<hr><br><strong>Tesis Adresi </strong><br><br>');
    end;
    if dongu = 28 then begin
      Response.Content :=Response.Content + '<hr><br><strong>Tesis Adresinden farklý ise tebligat adresi </strong><br><br>';
      MailGonder.PostMessage.Body.Add('<hr><br><strong>Tesis Adresinden farklý ise tebligat adresi </strong><br><br>');
    end;
    if dongu = 37 then begin
      Response.Content :=Response.Content + '<hr>';
      MailGonder.PostMessage.Body.Add('<hr>');
    end;
  MailGonder.PostMessage.Body.Add(Request.ContentFields[dongu]);
  Response.Content :=Response.Content + Request.ContentFields[dongu]+'<br>';
  end;


try
  if TMail.FindKey(['SYS']) then
  MailGonder.PostMessage.FromAddress := TMailEmail.Text;

  MailGonder.PostMessage.FromName    := TMailTanimi.Text;
  MailGonder.PostMessage.Subject     := 'Kablo TV Baþvuru Formu';

  if TMail.FindKey(['KTV']) then
  MailGonder.PostMessage.ToAddress.Add(TMailEmail.Text);

  MailGonder.Connect;
  MailGonder.SendMail;
  Response.Content :=Response.Content + Request.RemoteAddr;
  MailGonder.Disconnect;
except
  Response.Content :=Response.Content + 'Mail Gitmedi';
end;
  DB1.Close;
end;
0
 
LVL 17

Expert Comment

by:inthe
ID: 2633545
bit irrelevent to the problem at hand though isnt it..
0
 

Author Comment

by:omri_ori
ID: 2634924
thenks for the answer.
It still give me a small problem if my default e-mail client is outlook. the text from buffer is entered into recipient and not in the proper locations (subject,body..).

with netscape messenger it works fine

thenks again
ori
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

610 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