I need to send a pdf file received from SFTP with an email as an attachment. I am just looking if this can be done without using custom pipeline component. Can this be done only with SMTP send port configuration. How can this be approached
In your orchestration your Out message must be modified like below. You must give your file list with pipe delimited list.
MessageOut(SMTP.Attachments) = "C:\\temp\atachment1.pdf|C:\\temp\atachment2.pdf";
Related
How I can get the attachment from a mail in WSO2 ? I able to get the subject and body of the mail. I need to fetch an attachment file in the mail. How it could be done ? I'm using Gmail POP3 server.
There is nothing specific whether the mail is from some WSO2 server or not. If you have attachments, that implies the mail uses multipart/form. Therefore you can process it as a multipart/form message. There are a lot of libraries that you can use to do the parsing. e.g. Apache Commons, Javamail or you can use normal java URL connection and carefully work with the mime boundaries.
We used to parse the whole message body looking for boundries of attachments, then apply Base64Decode to substracted pieces, then operate with them like binaries.
Sorry, I do not have that synapse-config right now, can not tell you exactly what to do.
In order to send data to google spreadsheet I need to request HTTP access to the unique URL, something like this:
https://script.google.com/macros/s/AKfycbz7jkkd7nfa6ThjOqGw5KZgnUUxIOrxCV_m8WithLQD4EAS7hx6/exec?SOMEDATEHERE
I tried with:
GET https://script.google.com/macros/s/AKfycbz7jkkd7nfa6ThjOqGw5KZgnUUxIOrxCV_m8WithLQD4EAS7hx6/exec?SOMEDATEHERE HTTP/1.0,
but with no success.
Any idea how to execute this HTTP request with AT Commands?
I manage to do it.
First of all I wasn't able to make it work with Arduino IDE Serial Monitor because of Carriage Return and New Line characters so I switched to RealTerm. In it I manually write "\r\n" after every AT command. New i connected Googles Spreadsheet link with Pushingbox (as shown in this video). After that I used next AT commands:
// Only after Restarting module
//-----------------------------
AT+CIPMODE=0\r\n
AT+CIPMUX=1\r\n
//-----------------------------
AT+CIPSTART=4,"TCP","api.pushingbox.com",80\r\n
AT+CIPSEND=4,89\r\n
GET /pushingbox?devid=<DevID>&<field>=<value> HTTP/1.1\r\nHost: api.pushingbox.com\r\n\r\n
Thanks for help.
I have an asp.net mvc application, which allows to upload company structure using CSV file. I was asked about possibility to automate this function using powershell script.Creating CSV in powershell is easy, but I do not have an idea how upload to asp.net.
My first choice was to use WebClient, but I have problem with authentication - in mvc we are using forms authentication.I read here that it is possible, but if my login form changes I will have to send updated script to client. I would like to omit mange code on client side.
The second option is to crate separate controller and use in it authorization token, but I look like "inventing a wheel again", because I would need to write all code responsible for authentication.
Can I improve one of above options? Or maybe there is a better choice?
You might be able to use the existing web service using the Invoke-RestMethod cmdlet, but it could take two separate invokes. For both invocations you'll probably need to say -Method Post. Its possible to do all this with WebClient, but the cmdlet may be easier to describe. I haven't actually tried this, but it could look something like this:
Invoke-RestMethod -Method Post $loginPage -SessionVariable webSession -Body "..."
Invoke-RestMethod -Method Post $uploadPage -WebSession $webSession -Body "..."
For the first invocation, you specify the URL of the login page, and would simulate a web forms login by providing a username and password in the -Body parmeter, and use -SessionVariable to capture and store context for making the next request(s) authenticated.
In the second request, you use your data upload URL, the -WebSession parameter to supply the context established by the first request, and -Body to upload your CSV. Note that you need the dollar sign on the webSession variable in the second one, but not the first.
Of course, you'll need to store the username/password for the automation to use somewhere, but that's always needed for unattended automation. A possible slick approach to mitigate this would be to use client certificate-based credentials rather than a web form authentication.
How about using a side channel?
There are two approaches. You either send it to the customer's web server every now and then, or the web server downloads the data from you.
For sending data, FTP over SSL should be secure enough. Here is an example about how to command FTP with Powershell. FTP/SSL is easy enough to configure for IIS.
For receiving data, just publish the CSV on your own web site. Set up a script on the customer's web server that downloads CSV every now and then. If the CSV should not be accessible to anyone but the customer, require a client certificate.
I would probably do it like this:
Step 1: Create an https webpage on the asp.net server to receive the csv
Step 2: Create a powershell script that calls curl with the -F option to post a file to it and append any metadata you need on the call
Step 3: Upon receiving the file, store it using the metadata provided in the form and append clientid/date/etc to the file
I do not find a way to get attachment file name without downloading the whole message using OpenPop.Net
The Pop3Client.GetMessageHeaders do not expose any data about attachments. The Pop3Client.GetMessage(messageNumber) gives attachment data but first download the whole message.
Maybe someone know how to do that?
I am the main developer for OpenPop.Net.
If you take a look at the RFC for POP3 you will notice that it is not possible to get information about attachments. To get the message headers, OpenPop.Net current sends the TOP <messagenumber> 0 command to receive headers.
Since attachment headers are located deep inside the message body, I cannot see how any POP3 client should accomplish your requirement.
IMAP is another protocol, and it includes features which allows the IMAP client to get information about each part inside a message. You might want to go in that direction.
I am sending email using asp.net and it is working fine. But when an email gets failure to deliver then the failure email which i get becomes unformatted.
the email contents are in html format and attached .doc files.
i am smtp for sending emails.
i think that, this is not because of code i am using to send email so i am not putting sending code here.
Please suggest me what should i check.
Thanks
Mail failure of mail sending is because of your smtp configuration or by data transportation blockage. and this will read your attachment as byte[] so its only the reason to make sure that your smtp configuration is well working...