How to create a mail with TSendMail? - delphi

In a Delphi 10.4.2 VCL Application in Windows 10, I followed the TSendMail example here:
http://docwiki.embarcadero.com/CodeExamples/Sydney/en/TSendMail_(Delphi)
... to create a InternetSendMail1 action in the ActionList.
But when I execute this code:
var OK := InternetSendMail1.Execute;
CodeSite.Send('OK', OK);
OK returns True.
But nothing happens: No email is opened.
My email client Thunderbird is a regular registered MAPI mail client working perfectly for many years: For example, when I click a mailto link then a new email is created in Thunderbird etc.
So what must I do to make the InternetSendMail1 action work?
EDIT: I finally realized that what I want to do is not actually sending a mail but creating a mail with an attachment, so the user can edit it with a recipient, body, etc., and then send it after he has finished editing it. So I changed the question from "How to send a mail with TSendMail?" to "How to create a mail with TSendMail?".

Related

Keep textarea active after message is sent

I'm creating a chat application with Angular and I got stuck on the following case:
When a user sent a message he has to click the chat area (it is a textarea) again to send a new message.
How can I keep the textarea active when a message is sent and the client to be able to write instantly after that without click the textarea again?
I tried to simulate a click (el.click()) on the textarea after the message is sent but it doesn't help. I tried also with el.focus().
If anyone else stuck on a similar case here is the solution:
el.focus()
should be done in
ngAfterViewInit()

Unable to send mail using SKPSMTPMessage

I am using SKPSMTPMessage to send emails in background and it is working too. But the problem arises in one particular case. There is a part where I have to use a string returned from a webApi as the email body. The SKPSMTPMessage delegate shows sending successful but the mail is never received. I have tried changing the returned string in various ways like removing newline characters and whitespace characters too. The weird part is that when I change a particular Capital (A -in approve) letter to small letter, the mail gets delivered.
The string I am using as mail body is :
You have new App registration Approval request.
Name:rktest26
Email :rktest26#test.com
Mobile
Phone:
Address:a1asssaasssa
To Approve please click the below link.
(some link)
ClientId=38&EmailId=rktest26#test.com&Approved=1
To Reject please click the below link.
(some link)
If I remove the string content after Address:a1asssaasssa part, it gets delivered.
What can I do so that the whole message gets delivered?

How to send background email after button press?

I'm building an internal app. I want to be able to press a button, and have the app automatically send a predefined email message to a specified email address, without the user knowing. I have access to a web-server, but I'm just not quite sure on what the best way to go about doing this is.
I'm using storyboard in xcode, this is a singleview application for the ipad.
Any suggestions are greatly appreciated.
You can create a PHP script that can do this (code below). Use a library such as ASIHTTPRequest to post the user's email address to the script and then the script will automatically send the message.
<?php
$to = $_POST["email"]; //this is the user's address; you can replace $_POST["email"] with "user#example.com" to try it out
$subject = "Subject";
$body = "Message";
$headers = "From: Name <noreply#example.com>\r\n" . "X-Mailer: php";
if (mail($to, $subject, $body, $headers)) {
//sent
}
?>
If you want to use the user's mail account that they have set up in the mail.app - you can't do that without the MFMailComposeViewController.
Solutions are:
Use some Framework or roll your own mail solution that you or the user fills with their respective mail acc data and then send mails.
or
Write a little PHP/Ruby/Java/... script that sends a mail which you can trigger via web request (i.e. REST).
SKPSMTPMessage works well for sending emails without the need for a UI.
(Make sure you add a reference to the CFNetwork.framework in your project.)

TFS2010 web - Send notification to user who logged the work item

How can i send notification to user about accepting the work item?
i have send notification to me, but how do i send the email to user who logged the work item?
any ideas ?
You requirements are a bit to complex to be handled out of the box. Please take a look at the Event Notification Plugin for TFS2010 hosted at codeplex under project name Team Alert: http://teamalert.codeplex.com/.
It is a server side extension for TFS 2010, which allows you sending E-Mail notifications to any person field in the event, regardless the field contain a SID, account name or display name.
The creator talks about your very needs on his own website: http://fszlin.dymetis.com/post/2011/03/22/Event-Notification-Plugin-for-TFS-2010.aspx.
The configuration for you could be something like this:
<alert name="Bug Changes" event="WorkItemChangedEvent"
filterExpression="$"CoreFields/StringFields/Field [ReferenceName='System.WorkItemType']/NewValue" = Bug AND $"CoreFields/StringFields/Field[ReferenceName='System.AuthorizedAs']/NewValue" <> $"CoreFields/StringFields/Field[ReferenceName='System.CreatedBy']/NewValue"">
<recipients>
<recipient
name="Owner" address="CoreFields/StringFields/Field[ReferenceName='System.CreatedBy']/NewValue"
type="DisplayNameField"
allowHtml="true"/>
</recipients>
</alert>
Does that solve your needs?

SendGrid - Custom Event Notification App in header

I am trying to use SendGrid's Event Notification App (http://sendgrid.com/documentation/display/apps/EventNotification) for emails of certain categories. The Event Notification on my SendGrid account is empty. The header I'm putting on my email is:
X-SMTPAPI: {"category":"category","filters":{"eventnotification":{"settings":{"url":"theurl"}}}}
But I'm not getting a callback on my url. A simple curl post on this given url gives me the expected output, so I'm pretty sure that should be working with SendGrid too.
Do you have any ideas on what the header should look like? I couldn't find too much documentation on the website for this specific app...
Thanks!
Here is an example of the header that I am successfully sending with my Sendgrid emails:
headers("X-SMTPAPI" => "{\"unique_args\": {\"customer_id\":\"#{customer.id}\",\"email_batch_id\":\"#{batch_id}\"}, \"category\":\"monthly_statement\"}")
Make sure you have the correct events checked under the event notification settings in Sendgrid.

Resources