Need to send HTML email with bcc, help please
Need to send HTML email with bcc, help please
Hi,
I need to send some HTML email to several email adress, so i will use BCC.
Can you help me pointing the best way to achieve it?
In the past i used some command line (freeware) toi achieve it.
Best Regards
I need to send some HTML email to several email adress, so i will use BCC.
Can you help me pointing the best way to achieve it?
In the past i used some command line (freeware) toi achieve it.
Best Regards
ARGENTINA WORLD CHAMPION
Re: Need to send HTML email with bcc, help please
If your server does not require TLS then use @clipper, @ts-soft, @NALOR's code:
viewtopic.php?p=526455#p526455
You could use infratec's libcurl.pbi if you need TLS but, you'll have to make sure you follow
RFC532 to create emails. Take a look at how the non TLS is implemented ( boundaries, content disposition, etc.. so you can see what you need to do ):
viewtopic.php?p=526583#p526583
also use google search to search for answers in purebasic forums:
https://www.google.com/advanced_search? ... rebasic.fr
Norm.
viewtopic.php?p=526455#p526455
You could use infratec's libcurl.pbi if you need TLS but, you'll have to make sure you follow
RFC532 to create emails. Take a look at how the non TLS is implemented ( boundaries, content disposition, etc.. so you can see what you need to do ):
viewtopic.php?p=526583#p526583
also use google search to search for answers in purebasic forums:
https://www.google.com/advanced_search? ... rebasic.fr
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
-
- Enthusiast
- Posts: 542
- Joined: Tue Oct 14, 2014 12:09 pm
Re: Need to send HTML email with bcc, help please
viewtopic.php?f=14&t=35081&hilit=HTML+EMAIL
is the answering of your question.
I adapt it from Autoit, and i use it in most of my programm. It's based on CDO (object present in windows)
Hope it will help you.
is the answering of your question.
I adapt it from Autoit, and i use it in most of my programm. It's based on CDO (object present in windows)
Hope it will help you.
Re: Need to send HTML email with bcc, help please
What's wrong with using the #PB_Mail_Bcc flag with PureBasic's "AddMailRecipient" comand? Works for me.
Re: Need to send HTML email with bcc, help please
As far as I know, the PB-Mail-Library doesn't support HTML-formatted e-mails.Dude wrote:What's wrong with using the #PB_Mail_Bcc flag with PureBasic's "AddMailRecipient" comand? Works for me.

Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Re: Need to send HTML email with bcc, help please
Sicro wrote:As far as I know, the PB-Mail-Library doesn't support HTML-formatted e-mails.Dude wrote:What's wrong with using the #PB_Mail_Bcc flag with PureBasic's "AddMailRecipient" comand? Works for me.
That is what i found.
ARGENTINA WORLD CHAMPION
Re: Need to send HTML email with bcc, help please
Sorry, I overlooked the HTML bit. 

Re: Need to send HTML email with bcc, help please
Hi
I send HTML emails all the time with PB. HTML is just text so you can for example do SetMailBody(1,"<html><b>This is a test</b></html>") and it will send the email just fine and if the recipient's email client supports HTML then they see the message as expected. I can embed images in the HTML as long as I base64 encode them like so:
<img alt="Company Logo" src="data:image/jpeg;base64,**base64 encoded data goes here**">
Simon
I send HTML emails all the time with PB. HTML is just text so you can for example do SetMailBody(1,"<html><b>This is a test</b></html>") and it will send the email just fine and if the recipient's email client supports HTML then they see the message as expected. I can embed images in the HTML as long as I base64 encode them like so:
<img alt="Company Logo" src="data:image/jpeg;base64,**base64 encoded data goes here**">
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Need to send HTML email with bcc, help please
Thanks, Simon. I will try this when I get home.swhite wrote:I send HTML emails all the time with PB. HTML is just text so you can for example do SetMailBody(1,"<html><b>This is a test</b></html>") and it will send the email just fine and if the recipient's email client supports HTML then they see the message as expected. I can embed images in the HTML as long as I base64 encode them like so:
<img alt="Company Logo" src="data:image/jpeg;base64,**base64 encoded data goes here**">
Re: Need to send HTML email with bcc, help please
@dude, don't try it when you get home. It does not work. An email is just text but there are certain rules that have to be followed. sure you'll send html but the client will not display it, instead it will show the actual code ( gmail or outlook to name the most important ones ) here is a hack that will work on some systems like Firebird:
first create a text file with html, I called it somehtml.txt, you'll see that it is a table which makes it a single item,
as long as you use a table to insert you text it will work with gmail :
now use the PB example and make sure you use the right email and email server info, also do not add a ;SetmailBody()
now test then Disco.
Norm.
first create a text file with html, I called it somehtml.txt, you'll see that it is a table which makes it a single item,
as long as you use a table to insert you text it will work with gmail :
Code: Select all
<table width='100%'border=0>
<tr width='10'>
<td>nice space</td>
<td><h1><b> can this be </b> </h1></td>
<td></td>
</tr>
<tr>
<td></td>
<td style='color:red;'><h1> This hack works when <u>email reader</u> is <b>Thunderbird</b> </h1></td>
<td></td>
</tr>
<tr >
<td></td>
<td style='color:blue;'><h2>does not work?!? with <i>Outlook</i> or <i>Gmail</i></h2></td>
<td>last space</td>
</tr>
</table>
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Mail example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
InitNetwork()
If CreateMail(0, "test@youraddress.com", "Hello last !") ;from email address
; SetMailBody(0,"<html><b>This is a test</b></html>") ; no mail Body
SetMailAttribute(0, #PB_Mail_Custom, "Content-Disposition: inline") ; if we could change the Content-Disposition from attached to inline
; it has To be an attachment no Data attachment or it wont work
;
AddMailAttachment(0, "text/html", "somehtml.txt","text/html") ; HTML
; Change the recipients to real one
;
AddMailRecipient(0, "youraddress@youraddress.com", #PB_Mail_To)
; Set the SMTP server to use
;
Result = SendMail(0, "smtp.gmail.com", 587, #PB_Mail_Asynchronous|#PB_Mail_UseSSL,"Login@gmail", "password")
Repeat
Progress = MailProgress(0)
Delay(300)
Until Progress = #PB_Mail_Finished Or Progress = #PB_Mail_Error
If Progress = #PB_Mail_Finished
MessageRequester("Information", "Mail correctly sent !")
Else
MessageRequester("Error", "Can't sent the mail !")
EndIf
EndIf
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: Need to send HTML email with bcc, help please
Correct. Simon's tip did not work for me with Gmail.normeus wrote:@dude, don't try it when you get home. It does not work.

Re: Need to send HTML email with bcc, help please
Hi
My apologies for misleading everyone about sending HTML emails from PB. It turns out we are indeed using PB but the email component is based on a Chilkat email library. So I do include html in the message body but that only works because the Chilkat library correctly formats the email.
Simon
My apologies for misleading everyone about sending HTML emails from PB. It turns out we are indeed using PB but the email component is based on a Chilkat email library. So I do include html in the message body but that only works because the Chilkat library correctly formats the email.
Simon
Simon White
dCipher Computing
dCipher Computing
Re: Need to send HTML email with bcc, help please
@normeus, I can confirm your trick works with Gmail and shows HTML inline for emails (see below). Nice! 
Downsides: It adds an attached HTML document with the email, which is a little bit undesired but I can live with it beause I know it's necessary; but I'm mostly worried that the HTML won't show up for all mail software. Can anyone reading this please try it with other mail apps and post their results in this topic? Thanks!
List of compatible email software: Gmail, Thunderbird.
List of incompatible email software: Mailinator.


Downsides: It adds an attached HTML document with the email, which is a little bit undesired but I can live with it beause I know it's necessary; but I'm mostly worried that the HTML won't show up for all mail software. Can anyone reading this please try it with other mail apps and post their results in this topic? Thanks!
List of compatible email software: Gmail, Thunderbird.
List of incompatible email software: Mailinator.
