How to determine minimum sample size for Bernoulli trials at a given confidence level? I want to determine whether the true bounce rate of an email campaign (an email sent to many recipients) is <20%, at the 99% confidence level. I can send one "test batch" of randomly selected emails from the campaign and record the resulting binary bounce/no bounce outcomes before deciding whether to send the remaining emails. 
If the campaign has true bounce rate >=20%, we want to flag it for manual review; if the campaign has <20% true bounce rate, we want to send the entire campaign without review. What is minimum number of emails I would need to send in the "test batch" to reach 99% confidence, and what should my threshold for manual review be? 
My current thinking is to simulate draws from a Bernoulli process where the true fraction of positives is 0.2. Look at the lower bound of the 98% confidence interval (98%--not 99%--because we are only interested in unlikely outcomes in the leftmost tail). Because I want the resulting "rules" to be applied to all campaigns, regardless of the size of the campaign, I simulated the Bernoulli process 100 times to get a sense for the variance of that lower bound. I determined that if we use a test batch of 200, when the bounce rate of the test batch is <10% we can safely conclude that the true bounce rate of the campaign will be <20%. 
Here's my Python code:
def mean_confidence_interval(data, confidence=0.90):
    a = 1.0 * np.array(data)
    n = len(a)
    m, se = np.mean(a), scipy.stats.sem(a)
    h = se * scipy.stats.t.ppf((1+confidence)/2., n-1)
    return m-h #sample mean minus confidence interval

for i in range(100):
    data = np.random.binomial(1, 0.2, size=200) # simulate the data
    print(mean_confidence_interval(data, confidence=0.98))

Is there a better way to think about this?
 A: Null and alternative hypotheses. Let's call 'bounce rate' $\theta.$ From your discussion about confidence intervals, it seems, based on a small pilot study, you want to test $H_0: \theta \le .1$ (pilot study OK) against
$H_a: \theta > .1$ (unsuccessful). 
Significance level. It seems you want to test at level $\alpha = .05.$ That means you are unlikely to reject $H_0$ (and presumably re-do your web page), if the bounce rate really is below $0.1$ as a best case possibility. 
Power. By contrast, you want to be reasonably sure to reject $H_0$ if $\theta$ is much 
larger than $0.1.$ The question is how much greater should trigger rejection of $H_0?$  It seems 
that you would want to be very sure to reject $H_0,$ if the true bounce
rate is as large as $\theta = 0.2.$ Perhaps you want the 'power' of the test
to be 95% or 99%. That means you want $P(\text{Reject } H_0 | \theta = 0.2) = 0.95$ or $0.99.$
Minitab power computation and power curve. Many statistical software programs will make power computations showing various
possibilities. Here is one from Minitab.
Power and Sample Size 

Test for One Proportion

Testing p = 0.1 (versus > 0.1)
α = 0.01


              Sample  Target
Comparison p    Size   Power  Actual Power
         0.2     266    0.99      0.990166
         0.2     184    0.95      0.950160

Here is a related figure from Minitab, showing power for alternative
values other than $\theta = 0.2.$ The broken red line shows power $0.99$
at $\theta = 0.2$ for $n=266.$

Details of power computation. One computation (in R, where pbinom is a binomial CDF) goes as follows:  First, we find the critical value for the
test. If $\theta = 0.1,$ then how many 'bounces' out of $n = 200$ emails
does it take to trigger rejection at the 5% level?  That is, find $c$ such that
$P(X \ge c | \theta=0.1) = .05.$ Because the binomial distribution is discrete
we can't make the answer exactly $0.05;$ using $c = 27$ gives $0.067$ and
$c = 28$ gives $0.043;$ we use $[28, 200]$ as the 'rejection region'.
qbinom(.95, 200, .1)
[1] 27
1 - pbinom(26, 200, .1)
[1] 0.06722468
1 - pbinom(27, 200, .1)
[1] 0.0434285

Then to find the power against the alternative $\theta = 0.2,$ we find the power as 
$P(X \ge 28 | \theta = 0.2) = 0.989.$
1 - pbinom(27, 200, 0.2)
[1] 0.9890492

So it seems your conclusion is correct:  $n \approx 200$ is an appropriate sample size
for a pilot study.
Here is a 'power curve' showing powers for various alternative values of
$\theta \in (.1, .25)$ for a test at level $\alpha = 0.043$ and emphasizing
the power against $\theta = 0.2$ (red dotted lines).

