First of all, atmospheric attenuation in the visible region is primarily due to scattering, not molecular absorption as in the infrared and microwave regions. This is perhaps not that important to your question, but a good thing to keep in mind. The ligth doesn't disappear, it only changes direction.
If you have the density profile of the atmosphere, let's denote it $\rho(h)$, where $h$ is the height above sea level, you can calulate what you call mass-thickness, (I will call it slant mass column and denote it $C$), using this integral:
$$
C=\int^{\infty}_{0}\frac{\rho(h)dh}{\sqrt{1-\left(\frac{\cos{\theta_0}}{1+h/R}\right)^2}}
$$
or this one:
$$
C=\int^{\pi/2}_{\theta_0}\rho\left(R\left(\frac{\cos{\theta_0}}{\cos{\theta}}-1\right)\right)\frac{R\cos{\theta_0}}{\cos^2{\theta}}d\theta
$$
where $\theta_0$ is the elevation angle of the sun and $R$ is the earth radius. These formulas are for an obeserver located at sea level.
This assumes that the light travels straight through the atmosphere. This assumption works reasonably well for high elevation angles, but for lower angles (think sunsets) you have to take atmospheric refraction into account and perhaps also some additional scattering effects.
Your digital camera experiment might work in theory but it will perhaps not be as easy as you would like. First of all you need to account for refraction when calculating the slant mass column as I explained above. Refraction is wavelength-dependent so you will have to do it for each color. Secondly, only Rayleigh scattering will be proportinal to $C$. You will also have Mie scattering due to aerosols. This will depend on the aerosol loadings in the atmosphere which will be variable. Mie scattering will also be more important for low elevation angles since a larger part of the path through the atmosphere will be in the lower parts, which have higher aerosol loadings.
The light of the moon is a reflected light, and thus displays the type of surface on the moon in its spectral composition.
On the other hand the red orange of sun is seen through clouds or low in the horizon from secondary interactions. When overhead it is yellow and if behind clouds sometimes white . Part of the difference in the colors we perceive is also due to the much smaller amplitude of the light of the moon.We can look at the moon directly, not at the sun.
Best Answer
This is due to Rayleigh scattering, i.e. the shorter wavelengths (those near the violet end of the visible spectrum) are more deflected by dust particles than the longer wavelengths (those near the red end of the visible spectrum).
When the sun is near the horizon, it the path of the light through the atmosphere (and in particular through layers which have a higher concentration of dust particles) is longer, thus the scattering away of the non-red components is more pronounced.