Send Mail using OutlookExpress

I want to send e-mail to a given recipient. The problem is that there should be a file attached. I made it using Outlook, but it doesn't work with OutlookExpress. Here is the code. Any idea ???


    OutlookApplication.Connect;
    NmSpace := OutlookApplication.GetNamespace('MAPI');
    NmSpace.Logon('', '', False, False);
    MailItem1.ConnectTo(OutlookApplication.CreateItem(olMailItem) as MailItem);
    MailItem1.Recipients.Add(ebMail.Text);
    MailItem1.Subject := 'sample';
    MailItem1.Attachments.Add('C:\abc.xls', EmptyParam, EmptyParam, EmptyParam);
    MailItem1.Send;
    Close;
LVL 1
simoraikovAsked:
Who is Participating?
 
BmacriConnect With a Mentor Commented:
Try using SMTP delphi comes with an example  \Demos\SMTP

Try that
0
 
EpsylonCommented:
It's not possible to use this code to control OutlookExpress, only Outlook. I think the only way to send attachments is using MAPImail from Simonet (Alex). You have seen that demo already I believe.
0
 
florisbCommented:
Does outlook-express provide a library to import? Check it; as said; code above is Outlook.
0
 
SeregaCommented:
If OutlookExpress is default mailer in your system, you can do it simply by ShellExecute.
0
 
simoraikovAuthor Commented:
The problem is that I need to send attachment.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.