I felt this way too. Ds1 had neonatal jaundice, and was in an incubator - when his bilirubin levels didn't start to go down, they told me to supplement his breastfeeds with formula, because he needed the fluid and the calories - so of course I followed the doctor's advice - but this spelled the end of breastfeeding him. I tried to stimulate my supply, once I was home, by pumping, but after 10 days of pumping after every feed, I produced only 4.5ml in a day - exactly the same amount as I'd produced on day 1.
With ds2, I was adamant I was going to succeed at breastfeeding - he lost 10oz off his birthweight, and just didn't put it back on. I had the HV visiting every day or every other day, and saying she wanted him to put on half an ounce a day by her next visit. When she raised the idea of formula feeding, I told her how committed I was to succeeding with breastfeeding, and she said to me - and I quote - "Well, I have to think of the best interests of the baby!!" At which I asked her how dare she suggest I wasn't thinking of his best interests by trying to BF, and told her to leave my house!
At 6 weeks old, ds2 was admitted to hospital with a chest infection - but once we were on the ward, the main focus was his weight - I even heard them saying 'failure to thrive', which terrified me. Basically, we were kept on the ward until I agreed to start supplementing with formula, and he started to gain weight. Again, supplementing with formula spelled the end of breastfeeding.
With ds3, I mixed fed almost from the start, and kept it up for 12 weeks - twice as long as I had managed with either of his older brothers. I breastfed him during the day, and he had a formula feed last thing at night, and when he woke in the night. If he had those two formula feeds, he put on weight at a rate the professionals were happy with. If I replaced one of those formula feeds with a breastfeed, he stopped gaining weight.
I struggled for years with this, and with the feelings of guilt and inadequacy - all my friends breastfed with no problems, and I was so hard on myself because I couldn't - I think it contributed to me getting PND.
But over the years, I have come to realise that, although breastfeeding is an amazing thing to do for your child, there are so many other amazing things you can do - weaning them on home cooked food, for example, and encouraging them to try lots of different tastes. Reading to them, playing with them, doing craft activities, taking them to the park or the beach or the countryside, taking them to sports clubs or hobbies like Guides or Scouts, helping with homework - the list is endless.
And none of us can do 100% of these, 100% of the time. All we can do is our best, on the day. And that is fine - in fact, it is better than fine.
I now have three adult sons - two have degrees and are now working - one is a quantity surveyor with a law degree, and the other is a Maths teacher, and their younger brother is completing his degree. They are all healthy, happy young men, and none of them have suffered at all from not being breastfed for more than a few weeks.
Please don't beat yourself up - you are doing an amazing job.