• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2422
  • Last Modified:

delphi 7, silent sending mail, MAPI

I'd like to send "silent" email in delphi 7 using MAPI, just without Outlook dialogs displaying every time i send an email.
I have working code just can't figure out how to disable dialogs, wandering if changing this line could help:
Result := SM(0, Application.Handle, msg, MAPI_DIALOG or MAPI_LOGON_UI, 0);
1 Solution
Marco GasiFreelancerCommented:
I don't think it is possible, and however I'm sure it would not be politically correct nor legal send email without inform your user about. Are you sure to want to do it?
I know we were able to do it several years ago but it did require a mod to the MS Exchange server.  

MS in an attempt to help prevent malware from spamming people added a flag in Exchange that when set requires the prompt to the user before an EMail goes out.

If you can be certain that malicious code can't get onto your system or that you would detect it quickly than you might be able to reset the FLAG to 0

Sinisa VukCommented:
If you want to send mails I recommend to use great ICS (internet component suite). There is example/demo how to do this.
Agree that spamming is very bad, but I have some app registration project where ics help me out.

note: your exchange can be read for addresses but mails can be send wia ics.
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

Marco GasiFreelancerCommented:
I developed a small component to implement log files sending in my applications: this component post log files to my web server where a php script sends files as email attachments to my mail box. The component is free with source: maybe you can find it interesting, depending on what is your goal here. http://www.delphicoding.com/mgeasylog.php

Try it as follows...
Result := SM(0, Application.Handle, msg, 0, 0);

Open in new window

Some helpful links:
Sending an email from Delphi using MAPI
How to send email using the MAPI
If you now get a security warning from Outlook, you have 2 options to prevent this warning:

Disable warning in Outlook security center (line of action depends on your Outlook version)

If you are in a network and a network administrator controls the group policies, then you should ask your network administrator to add your program to the list of trusted programs, for which warning is not displayed...
spuppisAuthor Commented:
ICS works perfectly, it helped me find also the correct version of dlls which is 0.9.8h - Indy found at: http://indy.fulgan.com/SSL/Archive/
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.

Join & Write a Comment

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now