Using smtp mail is quite simple (jNet library), but I cannot send an html message containing an image.
I tried to send the html message by my mail agent (Thunderbird) and everything is ok.
Trying to send the same message by jNet the message is sent correctly, but at destination the image is not present.
The image is of course in an external server.
Searching the B4X forum I've found some threads about this problem and someone talked about a "NetExtra library" for this kind of problem, but I have not found this library.
Can someone help me?
thanks in advance
Roberto
Searching the B4X forum I've found some threads about this problem and someone talked about a "NetExtra library" for this kind of problem, but I have not found this library.
Thanks for the quick replies...but:
1) My images ARE inside my webhosting area, but the html email (sent by my B4J app) arrived at destination doesn't show the image.
The same html message sent by Thunderbird shows the image.
2) My app is a B4J app, so I cannot use this NetExtras library.
other suggestions?
thanks
here is my test project. You have to fill your specific fields for email service.
Using button SEND you send a plain text. Using button SEND HTML you send the file "objects/test1b.html".
You can try to send the same file by your mail client and you can see that the image is correctly sent.
thanks
Roberto
Really I don't understand where is the trick, because I tried to send the imaged html to a lot of different destinations, like @gmail.com or @yahoo.com , etc, but always the html message sent by Thunderbird is ok and the same html message sent by B4J app doesn't show the image. I also followed Stackoverflow suggestions, but always without success.
What can I try?
"this WORKS on Yahoo/Gmail" --> you'll have to compose the html mail following Gmail HTML syntax rules :
1) Add Free HTML Editor for Gmail extension on Chrome Browser
2) Write a new mail on Gmail and select Html Editor as mail Editor
3) Design the html mail:
4) Copy the Html Source and Paste it on html file (file test.html)
5) Send the mail from B4J
Html mail displays fine on Chrome browsers for Yahoo and Gmail mails
I will try exactly what you suggest. I have some doubts, because in the trial by Thunderbird I have selected "insert HTML text" and I have copied in it the Html file text (copy&paste)...and all was ok. Anyway I will try your method. Thank you for now.
Roberto
The trouble for you is that Gmail has a tight security plan for security wise by Gmail seen as dangerous attachments. You can simple avoid this Gmail security issue by dropping the attachments. Insert the text only converted image file as a base64 text string at image insert point.
The benefit for this solution is that every receiver of the email can see your image directly without the need to allow an (attached) images and replies also include the image view.
Effectively I have just considered the way to embed the image in the html file (base64), but really I don't like too much this solution. First of all because building the html page with an embedded image is not so plain (are there apps for this job?). I am not so sure that is a Gmail problem, first because I've tried to send the message to other destinations than Gmail and the problem is the same...and why if I send to any destination the same html page by my mail client (Thunderbird) all the results are ok (also for Gmail?).
I shall continue to try... (thanks to all for now)
You don't need any app or online conversion tool. Here you can find 4 lines of code to do the B4X solution for a image file to base64 string conversion on the fly and simply merged the result in your HTML page.
what a headache! also embedding the image in the html file the b4j app (like test2.zip) doesn't work (see embedded1 html file), but sending it by my mail client (Thunderbird) the image is ok. So the problem is not in the image itself, but in some other part of the message. I attach also the eml Thunderbird sent file (that works) and the eml B4j sent file (that doesn't show the image)....what a headache!!!
Roberto