- This topic has 5 replies, 1 voice, and was last updated 4 years, 6 months ago by
windip.
-
AuthorPosts
-
-
10 September 2020 at 09:01 #6227
Adnan Aygunduz
First of all, thank you so much for creating such a great library.
My problem is:
The code works perfectly.
EMailSender::Response resp = emailSend.send(“xxxxx@gmail.com”, message);
However;
When I use it like this, it gives me an error.
myemail=”xxxxx@gmail.com”
EMailSender::Response resp = emailSend.send(myemail, message);
no matching function for call to ‘EMailSender::send(String*, EMailSender::EMailMessage&)’
Couldn’t figure out the problem. Can you please point to me to the right direction? Thanks.
-
11 September 2020 at 22:37 #6261
Hi Adnan,
sorry if I response only now.
You can use a char array pointer
const char* emailToSend = "renzo.mischianti@gmail.com"; EMailSender::Response resp = emailSend.send(emailToSend, message);
I think you use a
String
variable formyemail
, change type.Bye Renzo
-
17 September 2020 at 01:01 #6307
Adnan Aygunduz
Hi Renzo,
Thanks a lot. It worked.
I just added .c_str() to my strings to make the conversion.
-
25 November 2020 at 22:22 #8027
windip
Hi,
first I want to thank you for the great lib! I had to search 2 weeks to find a simple and working way to send e-mails from esp8266!
I send mails to multible adresses. When using an array of const char* everything works fine for me.
const char* mail_to_list[] = {“mail_01@gmail.com”, “mail_02@yx.com”};
If I use:Â char* mail_to_list[] = {“mail_01@gmail.com”, “mail_02@yx.com”};
to be able to write the adresses with strcpy() to the variable (from a web interface), I get the error:Â Â “invalid conversion from ‘char**’ to ‘const char**'”
Is there a way, to get multible e_mail adresses from other variables to be sent?
Very thankful for any help,
windip
-
26 November 2020 at 08:34 #8037
Hi windip,
I think It’s better if you use an array of String instead of char*, in that situation you receive a warning like
ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
to manage this situation I use a simple String[].
This evening or tomorrow I’m going to release a new version (2.1.4) that can take a String[] or char* [] and convert It inside the library with a converter like
const char** toCharArray(String arr[], int num) { // If we ever alloc with new with have to delete const char** buffer = new const char*[num]; for(int i = 0; i < num; i++) { buffer[i] = arr[i].c_str(); } return buffer; }
and
const char** toCharArray(char* arr[], int num) { // If we ever alloc with new with have to delete const char** buffer = new const char*[num]; for(int i = 0; i < num; i++) { buffer[i] = arr[i]; } return buffer; }
I think It’s what you need.
Bye Renzo
-
-
30 November 2020 at 17:02 #8173
windip
Thank you so much for your quick response!
Everything works perfekt now using an array of String[3].Thanks,
WindiP
-
-
AuthorPosts
- You must be logged in to reply to this topic.