Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 750057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:30:24+00:00 2026-05-14T14:30:24+00:00

I use the following emailing function with Eudora. For some reason the attachment file

  • 0

I use the following emailing function with Eudora. For some reason the attachment file name is renamed to be something else. How can I make sure the attachment file name remains intact?

function SendMailMAPI(const Subject, Body, FileName, SenderName, SenderEMail, 
                  RecepientName, RecepientEMail: String) : Integer; 
var 
  message: TMapiMessage; 
  lpSender, 
  lpRecepient: TMapiRecipDesc; 
  FileAttach: TMapiFileDesc; 
  SM: TFNMapiSendMail; 
  MAPIModule: HModule; 
begin 
  FillChar(message, SizeOf(message), 0); 
  with message do 
  begin 
    if (Subject<>'') then 
    begin 
      lpszSubject := PChar(Subject) 
    end; 
    if (Body<>'') then 
    begin 
      lpszNoteText := PChar(Body) 
    end; 
    if (SenderEMail<>'') then 
    begin 
      lpSender.ulRecipClass := MAPI_ORIG; 
      if (SenderName='') then 
      begin 
        lpSender.lpszName := PChar(SenderEMail) 
      end 
      else 
      begin 
        lpSender.lpszName := PChar(SenderName) 
      end; 
      lpSender.lpszAddress := PChar('SMTP:'+SenderEMail); 
      lpSender.ulReserved := 0; 
      lpSender.ulEIDSize := 0; 
      lpSender.lpEntryID := nil; 
      lpOriginator := @lpSender; 
    end; 
    if (RecepientEMail<>'') then 
    begin 
      lpRecepient.ulRecipClass := MAPI_TO; 
      if (RecepientName='') then 
      begin 
        lpRecepient.lpszName := PChar(RecepientEMail) 
      end 
      else 
      begin 
        lpRecepient.lpszName := PChar(RecepientName) 
      end; 
      lpRecepient.lpszAddress := PChar('SMTP:'+RecepientEMail); 
      lpRecepient.ulReserved := 0; 
      lpRecepient.ulEIDSize := 0; 
      lpRecepient.lpEntryID := nil; 
      nRecipCount := 1; 
      lpRecips := @lpRecepient; 
    end 
    else 
    begin 
      lpRecips := nil 
    end; 
    if (FileName='') then 
    begin 
      nFileCount := 0; 
      lpFiles := nil; 
    end 
    else 
    begin 
      FillChar(FileAttach, SizeOf(FileAttach), 0); 
      FileAttach.nPosition := Cardinal($FFFFFFFF); 
      FileAttach.lpszPathName := PChar(FileName); 
      nFileCount := 1; 
      lpFiles := @FileAttach; 
    end; 
  end; 
  MAPIModule := LoadLibrary(PChar(MAPIDLL)); 
  if MAPIModule=0 then 
  begin 
    Result := -1 
  end 
  else 
  begin 
    try 
      @SM := GetProcAddress(MAPIModule, 'MAPISendMail'); 
      if @SM<>nil then 
      begin 
        Result := SM(0, Application.Handle, message, MAPI_DIALOG or 
                     MAPI_LOGON_UI, 0); 
      end 
      else 
      begin 
        Result := 1 
      end; 

    finally 
      FreeLibrary(MAPIModule); 
    end; 
  end; 
  if Result<>0 then 
  begin 
    MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError, [mbOk], 
               0) 
  end; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:30:24+00:00Added an answer on May 14, 2026 at 2:30 pm

    You have to set FileAttach.lpszFileName to the name you want your recipient to see. If you don’t do that an attachment like “C:\Document And Settings\MyUser\Local Settings\Temp\Hello.pdf” will look like “C__DOCUME~1_MyUser_LOCALS~1_Temp_Hello.pdf” to the recipient (this is probably different per e-mailclient ).

    So set FileAttach.lpszPathName to contain only the filename:

    begin 
      FillChar(FileAttach, SizeOf(FileAttach), 0); 
      FileAttach.nPosition := Cardinal($FFFFFFFF); 
      FileAttach.lpszPathName := PChar(FileName); 
      FileAttach.lpszFileName := PChar(ExtractFileName(FileName)); //add this
      nFileCount := 1; 
      lpFiles := @FileAttach; 
    end;
    

    The recipient will now see an attachment with the name “Hello.pdf” instead of “C__DOCUME~1_MyUser_LOCALS~1_Temp_Hello.pdf”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 392k
  • Answers 392k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The problem was that the per-process virtual memory limit was… May 15, 2026 at 1:43 am
  • Editorial Team
    Editorial Team added an answer I can't really tell from your code, but you have… May 15, 2026 at 1:43 am
  • Editorial Team
    Editorial Team added an answer Use java.math.BigInteger A quick example of usage: import java.math.BigInteger; public… May 15, 2026 at 1:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.