I wanna send an email automatically using python, and the code is as follows:
The content of the email looks like this:
<table border="2"><tr><th>Mx</th><th coslanb="5"> < img src="cid:image1" alt="image1" width="600" height="300" />< img src="cid:image2" alt="image2" width="500" height="300" /></th></tr> <tr><th>Tger</th><th coslanb="5"> < img src="cid:image3" alt="image3" width="600" height="300" />< img src="cid:image4" alt="image4" width="500" height="300" /></th></tr> <tr><th>1912</th><th coslanb="5"> < img src="cid:image5" alt="image5" width="600" height="300" />< img src="cid:image6" alt="image6" width="500" height="300" /></th></tr> <tr><th>Gold</th><th coslanb="5"> < img src="cid:image7" alt="image7" width="600" height="300" />< img src="cid:image8" alt="image8" width="500" height="300" /></th></tr> <tr><th>Abnormal</th><th coslanb="5">< img src="cid:image9" alt="image9" width="300" height="400" /> < img src="cid:image10" alt="image10" width="800" height="400" /></th></tr>
then I code this to add image into my email.
Files = [path1,...,path10]i = 1for filepath in Files: f = open(filepath,'rb') msgImage = MIMEImage(f.read()) f.close() msgImage.add_header('Content-ID','image%s'%i) msg.attach(msgImage) i = i +1
Finally, I find the 10th image isn't displayed. I've tried to change the sort of image but it doesn't work. I wanna figure the problem and fix it.