Aegis Implicit Mail AIM AlternateView in MimeMailMessage - implicit

I am using AIM Aegis Implicit Mail to send Implicit ssl mails.
When using subject and body in a mail message all is fine, however when I use alternate views my mai lhas an empty body. This alternate view setup works with mailmessage and has html and text body depending on the reciving client but I must use MimeMailMessage which looks ok in the debug code but is empty when recivied in the mailbox.
Here's the code:
string plainTextBody = "Welkom.";
AlternateView plainTextView =
AlternateView.CreateAlternateViewFromString(
plainTextBody, null, MediaTypeNames.Text.Plain);
plainTextView.ContentType = new System.Net.Mime.ContentType("text/plain");
mail.AlternateViews.Add(plainTextView);
string htmlBody = #"<html><body><img src=""cid:logo""><br /> Welkom </body></html>";
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
htmlView.ContentType = new System.Net.Mime.ContentType("text/html");
string imageSource = Path.Combine(HttpRuntime.AppDomainAppPath, #"Content\Images\Logob.png");
LinkedResource PictureRes = new LinkedResource(imageSource, MediaTypeNames.Image.Jpeg);
PictureRes.ContentId = "logo";
htmlView.LinkedResources.Add(PictureRes);
mail.AlternateViews.Add(htmlView);

Aim is not providing AlternativeView, however you can use inline attachments to put your images and directly set HTML code in your message body. try to download the sample code and have a look on how inline attachments are working

Related

Sending a webhook AND and a message in Pinescript v5

It appears that through the alert() function you can code a message to be sent, but what about the webhook?
I would like to use capitalise.ai, and they require to set in the alert both a webhook (https://tvwebhook.capitalise.ai) and a message, for example {"alertId": "b2f0d9f2-a848-48e4-8218-70350b24xxxx"} which will trigger a specific action, for example to buy or to sell.
Fact is, if I set in the UI an alert for a strategy I have created in Tradingview, there will be only one alert for all the possible events, and therefore only one message, but then how can I tell Capitalise.ai if the alert is for selling or buying?
I could do something like
if enterLong
alert("message 1))
else if enterShort
alert("message2"))
But then where do I put the webhook?
Thank you
You need different messages for different orders.
Check out this tutorial.
Your code must include something like this :
alert(jsondata, alert.freq_once_per_bar)
with jsondata a string in the json format.
Then your jsondata (your message) will be sent to your webhook.
To create the weebhook, look in the Alert Menu from your Tradingview Chart :
Choose the nae of your strategy in the Condition (Bybit Bot in the screenshot),
and create a 'Open-ended alert' alert :
Then go on the notification menu to give the url for the webhook :
I do something like this with a discord alert. Create your message in the script and not in the message box on the alert fly out.
I use this in a library
export GetDiscordJson(string userName, string avatar_url, string content, string title, string url, string description, string _fields, string _footer, string _authObject, string clr) =>
//parameters with _ lead are already formatted for the json end object
_username = jsonKeyValuePair("username", userName)
_avatarUrl = jsonKeyValuePair("avatar_url", avatar_url)
_content = jsonKeyValuePair("content", content)
_title = jsonKeyValuePair("title", title) // title = ticker
_url = jsonKeyValuePair("url", url)
_description = jsonKeyValuePair("description", description)
_color = jsonKeyValuePair("color", clr)
_embeds = str.format("\"embeds\":[{0}\n{1},\n{2},\n{3},\n{4},\n{5},\n{6},\n{7}\n{8}]", "{", _authObject, _title, _url, _description, _color, _fields, _footer, "}")
str.format("{0}\n{1},\n{2},\n{3},\n{4}\n{5}", "{",_username, _avatarUrl, _content, _embeds, "}")
Then in the indicator call it on each kind of alert
if enterLong
content = w.GetDiscordJson(_botName, _avatarURL, contMessage, syminfo.ticker, _titleURL, chartTimeframe, _fields, _footerObject, _authObject, _color )
alert(content, alert.freq_once_per_bar)
Simply put the webhook json string you get from capitalise into the alert(Capitalise-string,alert-frequency) command in your script. and then you can based on condition in your script decide which capitalise string to send. The alarm setup can only be done once with just the capitalise webhook URL, and leaving the message box empty.
Hope that’s understandable 😀

Liferay 7 apply programmatically a template to a journalArticle

I would like to apply a DDMTemplate pro-grammatically to JournalArticle. This is my code:
String prevDDMTemplate = articleDisplay.getDDMTemplateKey();
articleDisplay.setDDMTemplateKey(MY_SIMPLE_TEMPLATE);
articleContent = articleDisplay.getContent();
System.out.println(articleContent);
articleTitle = articleDisplay.getTitle();
articleDisplay.setDDMTemplateKey(prevDDMTemplate);
My expectation is that articleContent view is related to MY_SIMPLE_TEMPLATE template. But it doesn't work, the result is the content with the original template.
I need this change of view to print and to send the content by email. Is another way to do it?

Get FileDownloadUrl from attachment (Agile PLM)

I've been following the code samples included in Oracle document E15930_01 (Agile PLM Core Web Services User Manual). The samples are in Java, but I've translated what I need to .NET for the project I'm working on.
I can search for an object and return its attachments. I can get all the attachment properties except the one I need, fileDownloadUrl. This field is always blank.
Sample code follows. I thought by setting the property of allFiles to false and downloadUrl to true, I should get a download URL, but I don't. This code returns all the properties for the attachment except the one I want. Any thoughts on what I'm doing wrong?
AttachmentService svc = new AttachmentService();
svc.Credentials = credentials;
AgileGetFileAttachmentRequest[] req2 = InitializeArray<AgileGetFileAttachmentRequest>(1);
AgileFileAttachmentRequestType[] attachments = InitializeArray<AgileFileAttachmentRequestType>(1);
req2[0].classIdentifier = "MyIdentifier";
req2[0].objectNumber = "1234567890";
req2[0].allFiles = false;
req2[0].downloadUrl = true;
req2[0].attachments = attachments;
attachments[0] = new AgileFileAttachmentRequestType();
int rowId = getRowId(tt);
attachments[0].rowId = rowId;
GetFileAttachmentRequestType get = new GetFileAttachmentRequestType();
get.requests = req2;
GetFileAttachmentResponseType resp2 = svc.getFileAttachment(get);
AgileFileAttachmentResponseType[] attchResp = InitializeArray<AgileFileAttachmentResponseType>(1);
attchResp = resp2.responses[0].attachment;
Posting this in case someone else needs to do this or I need to do it later.
I found the data I needed. The download URLs are generated based on XML values in several fields in the database. They're the folder name, filename and FolderVersion on the row you're looking at. You need to parse the XML and retrieve the values to generate the link.
You can get the pattern for the download link through the Get Shortcut button.

What type of data goes into the <PDFBytes> for DocuSign composite templates?

The specific scenario that we are attempting to solve for our API solution is to create an envelope using a template and to replace the template document with a user specified document. DocuSign's documentation on creating a composite template show the steps for the serverside template and inline templates clearly, and this functionality is working correctly for us. However, the portion of the XML string containing the alternate document does not affect the template. Here is the link to DocuSign's example followed by the code snippet regarding document portion of the composite template.
https://www.docusign.com/p/APIGuide/Content/Sending%20Group/Rules%20for%20CompositeTemplate%20Usage.htm
<Document>
<ID>1</ID>
<Name>Form Document</Name>
<PDFBytes>PDF_BYTES_GO_HERE</PDFBytes>
<TransformPdfFields>true</TransformPdfFields>
<FileExtension>pdf</FileExtension>
</Document>
We have tried multiple variations of breaking down the pdf into bytes to insert into the "PDF_BYTES_GO_HERE" portion.
Here is the code we used to get the pdf bytes, convert them to a string and insert into the tag.
Dim fs As FileStream
fs = File.Open(filePath, FileMode.Open)
Dim bytes As Byte() = New Byte(fs.Length - 1) {}
fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length))
fs.Close()
Dim byteString As String = System.Convert.ToBase64String(bytes, 0, bytes.Length)
byteString is the string that we then use in the XML string.
"<Document>" & _
"<documentId>1</documentId>" & _
"<name>DOCUSIGN API TEST</name>" & _
"<PDFBytes>" & byteString & "</PDFBytes>" & _
"<TransformPdfFields>false</TransformPdfFields>" & _
"<FileExtension>pdf</FileExtension>" & _
"</Document>" & _
What type of data is expected within the tag and what is the best way to convert a pdf into that data?
Based on the documentation you've linked to, and the code sample you included, it seems as though you're using the DocuSign SOAP API. If that's the case, then the DocuSign SOAP API guide will be a useful reference for you. As the guide specifies, the PDFBytes property expects a base64-encoded byte stream that represents the document contents:
Are you manually constructing the XML payload? If so, you might instead want to consider adding a Service Reference to your project for the DocuSign WSDL, and then using the proxy classes (i.e., DocuSign object model) that come from that to construct the payload and subsequently send the envelope. If you go this route, the API guide contains code examples in a couple different languages that illustrate the setting of the PDFBytes property during Envelope creation -- starting on page 62. For example:
C#
// Attach the document(s)
envelope.Documents = new DocuSignWeb.Document[1];
DocuSignWeb.Document doc = new DocuSignWeb.Document();
doc.ID = "1";
doc.Name = "Document Name";
doc.PDFBytes = [Location of Document];
envelope.Documents[0] = doc;
PHP
// Attach the document
$doc = new Document();
$doc->ID = "1";
$doc->Name = "Picture PDF";
$doc->PDFBytes = file_get_contents("docs/picturePdf.pdf");
$env->Documents = array($doc);
Perhaps try modeling your approach after one of these examples (in VB, rather than C# or PHP)?

Mail-in db with attachments not appearing in the Body field

I have a mail-in database application and I am finding that occasionally an email is received with an attachment that is not part of the Body field and therefor not able to be "seen" by rtItem.EmbeddedObjects.
How do I identify that there is an attachment if it is not in the Body and once I do that how do I get a handle on it?
I need to determine the type of attachment (PDF, JPG, DOC, XLS, etc.), detach it and then process it based on the extension.
Here is the various If statements that do all the checking of the Body (RTF) field and the associated EmbeddedObjects. This does not catch an attachment that is "outside" of the Body.
Set rtItem = mailDoc.Getfirstitem("Body")
If ( rtItem.Type = RICHTEXT ) Then
If Not (IsEmpty(rtItem.EmbeddedObjects)) Then
ForAll o In rtItem.EmbeddedObjects
If (o.Type = EMBED_ATTACHMENT) Then
noAttachment = True
Else
noAttachment = True
End If
End ForAll
Else
noAttachment = True
End if
Else
noRTF = True
End If
I also have a document with nothing in the Body but $File contains the attachment name. How do you find that?
Youll need to get at those attachments using the EmbeddedObjects property of the NotesDocument. The union of that property plus all the EmbeddedObjects properties of all rich text items gives you access to all the attachments. Note that usually you only need to worry about the Body rich text item.
FYI we've hit a similar problem when the mail server was running out of disk space, or if a virus scanner blocked access to the attachment

Resources