BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Multiple email address in email widget


#3

yup, i have read that topic. but my question was, if the email widget or Blynk.email() supports multiple recipients or not.

…but after some experimenting, this is apparently not supported. i think i will try the gmail auto forwarding option.


#4

Think of it like Blynk.virtualWrite() commands… one action per command.

Or use the timers…

void emailSend()
{
  Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 1

  timer.setTimeout(16000L, []() {
    Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 2
  });

    timer.setTimeout(32000L, []() {
    Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 3
  });

    timer.setTimeout(46000L, []() {
    Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 4
  });
}

#5

now this seems an elegant solution…
i just tried the gmail forwarding, it is doable, but not very nice.


#6

hmm, actually i do not really understand this syntax:

timer.setTimeout(10000L, [] () {});

in the official simple timer docs for timer.setTimeout it is only this:

int setTimeout(long d, timer_callback f)

Call function f once after d milliseconds. The callback function must be declared as void f(). After f has been called, the interval is deleted, therefore the value timerId is no longer valid.

void callMeLater() {
    // do something
}

timerId = timer.setTimeout(1000, callMeLater);

but not a single word about [] () {} instead of the callback function…
could you point me toward the proper docs or explain a bit how this works?


#7

It’s the way I would do it. Why add extra code when Google has it covered for you.


#8

when you try to set up something like that in google, you will see. it is quite inconvenient, to add an email address to the forwarding list, the person with the new address has to send back a confirmation password to you, than you have to set up new filter for forwarding, etc.

if you later want to add a new person, or remove someone, you have to again meddle with the settings.

for me it seems much cleaner to remove / add a person by simply removing / adding a line of code…

also, if in the future i have to implement something like that in one of my clients project, than i have no other solution just code, because most clients are not capable to set up souch forwarding in google or other mail.


#9

We have this in our plans, as well as some rework of notification (notifs, mail, twitter) widgets, but I have no ideas of the time when it will be done.


#10

no stress :wink: i will test the solution provided by the big respected @Gunner, and if it works, i’m totally fine with that.


#11

Review below post (good stuff from @Fettkeewl):


#12

thanks for the link, i have read all that topic and also @Jamin’s topic about shorthands, but still nowhere explains this syntax meaning…

timer.setTimeout(10000L, [] () {});


#13

I don’t fully understand it either, but it uses something called Lambda Expressions and is basically a shorthand way of doing this…

void emailSend()
{
  Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 1
  timer.setTimeout(16000L, emailTwo);
  timer.setTimeout(32000L, emailThree);
  timer.setTimeout(46000L, emailFour);
}

void emailTwo() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 2
}

void emailThree() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 3
}

void emailFour() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 4
}

#14

ok, right now i’m reading the msdn lambda article, it perfectly makes sense now! this was the explanation i was looking for!

now i remember that back in the old days i’ve used such lambda functions in python too. but that was a long time ago, and python syntax is quite different than c++

thanks!


#15

Glad you understand it… I just keep a sample on hand and copy paste it where needed :stuck_out_tongue:


#16

Thanks @Gunner. This is a quicker substitute for my old standby.

void doNothing () {

}

Reading @Fettkeewl’s comments in linked post it is probably more memory efficient too. And you say you don’t teach coding here. :wink:


#17

Sometimes it just slips out of us :stuck_out_tongue_winking_eye: ;)!


#18

Actually, we are waiting for design from @Pavel for that task. It is very easy to impelement.


#19

I would like to add a vote for the ability to send to multiple recipients.

Perhaps this will help @pavel

RFC 2822 section 3.4 in fact describes how multiples should be defined:

When it is desirable to treat several mailboxes as a single unit
(i.e., in a distribution list), the group construct can be used. The
group construct allows the sender to indicate a named group of
recipients. This is done by giving a display name for the group,
followed by a colon, followed by a comma separated list of any number
of mailboxes (including zero and one), and ending with a semicolon.
Because the list of mailboxes can be empty, using the group construct
is also a simple way to communicate to recipients that the message
was sent to one or more named sets of recipients, without actually
providing the individual mailbox address for each of those
recipients.

https://tools.ietf.org/html/rfc2822#section-3.4

That would give us this sample syntax:

 Blynk.email("actionteam:email1@example.com,email2@example.com;","alert" ,"Come urgently");

If, in the back end you are throwing the email string at a fully compliant RFC2822 mail server I would expect it to ‘just work’ but a small test of this syntax did not produce the expected mails. :frowning:


split this topic #20

2 posts were split to a new topic: Massive delay with blynk notify messages getting pushed through


#21

Instead of resurrecting topics over a few months old (this one is over a year) Please create new topics to keep content clear and current.

As per the Developers requests, please also send ideas to https://portal.productboard.com/blynk/tabs/2-all-your-ideas.

Thank you.


closed #22