EWS Edit Attachments in a Forward Email - exchange-server

I'm working on an application that let users manage their emails from a website.
The user can reply to an email as well as forward a an email etc....
My problem is that I want to give the users the ability to remove attachments from
a forward instance of an existing email before sending it.
ResponseMessage response;
response = OriginalEmail.CreateForward(); // create response
ForwardEmail = response.Save(WellKnownFolderName.Drafts);
The ForwardEmail doesn't contain any attachment in the attachments collection.
However when using
ResponseMessage response;
response = this.Email.CreateForward(); // create response
this.Response = response.Save(WellKnownFolderName.Drafts);
this.Response.ToRecipients.Add("me", "me#gmail.com");
this.Response.Send();
I'm getting the attachments in the destination email.
How can I edit the attachments before forwarding?
Thanks in advance

After you call the Save method
ForwardEmail = response.Save(WellKnownFolderName.Drafts);
You should then do Load using a propertySet the specifies you want the attachments returned eg
PropertySet psPropset = new PropertySet(BasePropertySet.FirstClassProperties);
ForwardEmail.Load(psPropset);
That should then populate the Attachment Collection.
Cheers
Glen

Related

Shopping cart saved in firebase - order processing

my next question is about Firebase.
I have an application with spare parts for a car. In the application, a user authorized by email and password adds spare parts to his cart, which is stored in Firebase.
Question: how, by clicking the "submit order" button, send the contents of the cart to the seller (me) by mail?
Perhaps Firebase already has a ready-made solution / service for a similar task?
Does Apple's policy allow you to send the user's email address that was provided during registration for order feedback along with the request?
Here i trying to send order by MFMailComposeViewController
#IBAction func sendRequestButtonTapped(_ sender: UIButton) {
// Modify following variables with your text / recipient
let recipientEmail = "MyMail#gmail.com"
let subject = "description"
var body = "some array with ordered spare parts"
for i in objectsList {
body.append(i.objectFromPartsCatalogueListCode! + " " + i.objectFromPartsCatalogueListName!+"\n")
}
// Show default mail composer
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self //!!!
mail.delegate = self //!!!
mail.setToRecipients([recipientEmail])
mail.setSubject(subject)
mail.setMessageBody(body, isHTML: false)
mail.modalPresentationStyle = .fullScreen
self.present(mail, animated: true)
// Show third party email composer if default Mail app is not present
} else if let emailUrl = SendEmailManager.createEmailUrl(to: recipientEmail, subject: subject, body: body) {
UIApplication.shared.open(emailUrl)
}
It is difficult and opens an additional menu for choosing the method of sending. I want to receive an order with content from the application on my mail, one click by the user of the "sendRequest" button.
You can easily send emails from your app via a secure backend environment (eg. cloud functions).
There are many possible solutions, but here is one of them:
When a user hits submit, you can create a new document in a special Firestore collection (eg. emails) and have a cloud function listening to changes in that collection using a background trigger Firestore event triggers. This function will get the document changes, retrieve its data (email information, and any other metadata you've specified), and send an email using whichever email API you decide to use (eg SendGrid).
Alternatively, you can use the Firebase email extension Extension, but writing your own function isn't difficult.
An added benefit is you can store your personal email in your secure backend environment so your users won't be able to access it on their devices.

Send automatical email after save to database

I am new here.
I have a project in Laravel. I have one textarea and data from it is save in datavase. It works good. Now I would like to send automatical email to one specific email address with this data. It must be sent only one time with save to database.
I have no problem with sending email to customer with data but now I need to send email with data from this textarea to one specific email. It is a textarea what we have to buy for customer. It must be sent to our cooperation company.
Is it possible?
Ofcourse this is possible!
You should take a look at the following resources :
Observers
https://laravel.com/docs/6.0/eloquent#observers
Notifications
https://laravel.com/docs/6.0/notifications
-> specifically : https://laravel.com/docs/6.0/notifications#mail-notifications
yes, you can just trigger your function after saving: for example, after saving in controller.
public function store(Request $request){
$var = new Property; //your model
$var->title=$request->title; // the input that being save to database.
$var ->save();
// Send email to that input
Mail::send('email',['email'=>$request->title],function ($mail) use($request){
$mail->from('info#sth.com');
$mail->to($request->title);
});
return redirect()->back()->with('message','Email Successfully Sent!');
}

Sent Mail checking if it is delivered and open to recipient in Laravel

I want help in scaffolding code with Laravel default Mail package to send an email to the recipient with an enhancement that checks the status either mail is delivered to recipient and then check that either recipient opened the mail or not and then change the status of that email in my db_email_list. I googled it that to add headers just like follow the example but could not get it how to get the status
$message->getHeaders()->addTextHeader('X-Confirm-Reading-To','recipient_mail');
$sendEmail->getHeaders()->addTextHeader('Disposition-Notification-To','recipient_mail');
$sendEmail->getHeaders()->addTextHeader('Return-Receipt-To','recipient_mail');
When the user has gotten the email: Simply use this piece of code:
if (count(Mail::failures())) {
return false;
} else {
return true;
}
true=delivered, false=not delivered
When user reads the email: Hm sounds like you need to include a trick in your email in order to know if user has opened/read the email by simply adding for instance including an image on your email with a route defined in your end and passing user id as query param.
<img src="http://www.example.com/user-read-email?user_id=20" />
So whenever the user opens the email img src will fire a call to your url and simmply get the user id from the url, and set the flag for that user in db.

virtuemart 2 - how to send invoice as email attachment on confirm order

I want to send invoice as email attachment on order confirmation ,how to go about sending the invoice.
searched a lot ,not relevant data found.
The VM Order Confirmation Email work flow is as follows,
Check the function notifyCustomer() inside orders.php in administrator/components/com_virtuemart/models/
There is a section like shopFunctionsF::renderMail() It calls a function from shopefunctionsf helper file in /components/com_virtuemart/helpers/shopfunctionsf.php
renderMail() calls sendVmMail() in the same file there you can find option for attaching media or anything you want .
if (isset($view->mediaToSend)) {
foreach ((array)$view->mediaToSend as $media) {
//Todo test and such things.
$mailer->addAttachment($media);
}
}
Hope its helps..

Using EWS Managed API to create appointments for other users?

In EWS Managed API is it easy to create an appointment for a specific user:
ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredentials ( "administrator", "password", "domain" );
service.AutodiscoverUrl(emailAddress);
Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();
This will create a appointment for the administrator. But say I wanted to actually create an appointment for another user (not add that user as an attendee to me appointment). It this possible via the EWS Managed API?
Folder inboxFolder = Folder.Bind(service, new FolderId(WellKnownFolderName.Inbox, "user1#example.com"));
Will work too.
Then pass inboxFolder.id to the Appointment.Save call. The updates and deletes don't need this.
The best answer is to use impersonate, but this requires it to be enabled by the server admins. If you don't wield such power, this method will let you do what you need.
Note: the user running your application must have permissions on the target account or this will fail (as it should).
Found here: http://msdn.microsoft.com/en-us/library/gg274408(v=EXCHG.80).aspx
I know this has been answered but in answer to #Aamir's comment you can do this using delegates I've just done it for a project I'm working on.
As #matt suggested in his answer you can amend the save method of the appointment to point to the other users folder which in this case would be Calendar.
Code would look as below
Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save(new FolderId(WellKnownFolderName.Calendar, new Mailbox(_EmailAddress)));
Hope that helps
I figured it out from this article:
http://msdn.microsoft.com/en-us/library/dd633680(EXCHG.80).aspx
You should use the service.ImpersonatedUserId attribute.

Resources