gchar *subject;
gchar *body;
+ GSList *lst_addrs;
+
CamelInternetAddress *addr;
g_return_val_if_fail (IS_SOLIPA_MAIL_UI (mailui), FALSE);
if (g_strcmp0 (g_strstrip (from), "") != 0)
{
- addr = camel_internet_address_new ();
- camel_internet_address_add (addr, "Prova from", from);
- solipa_mail_set_from (smail, addr);
- camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ lst_addrs = solipa_mail_get_addresses_from_string (from);
+ if (lst_addrs != NULL)
+ {
+ addr = camel_internet_address_new ();
+ camel_internet_address_add (addr,
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "name"),
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "address"));
+ solipa_mail_set_from (smail, addr);
+ camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ }
+ else
+ {
+ g_warning ("Campo Da: mancante.");
+ return FALSE;
+ }
}
else
{
if (g_strcmp0 (g_strstrip (to), "") != 0)
{
- camel_internet_address_add (addr, "Prova to", to);
- solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_TO);
- camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ lst_addrs = solipa_mail_get_addresses_from_string (to);
+ if (lst_addrs != NULL)
+ {
+ while (lst_addrs != NULL)
+ {
+ camel_internet_address_add (addr,
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "name"),
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "address"));
+ lst_addrs = g_slist_next (lst_addrs);
+ }
+
+ solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_TO);
+ camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ }
+ else
+ {
+ g_warning ("Campo A: mancante.");
+ return FALSE;
+ }
}
else
{
if (g_strcmp0 (g_strstrip (cc), "") != 0)
{
- camel_internet_address_add (addr, "Prova cc", cc);
- solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_CC);
- camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ lst_addrs = solipa_mail_get_addresses_from_string (cc);
+ if (lst_addrs != NULL)
+ {
+ while (lst_addrs != NULL)
+ {
+ camel_internet_address_add (addr,
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "name"),
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "address"));
+ lst_addrs = g_slist_next (lst_addrs);
+ }
+
+ solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_CC);
+ camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ }
}
if (g_strcmp0 (g_strstrip (bcc), "") != 0)
{
- camel_internet_address_add (addr, "Prova bcc", bcc);
- solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_BCC);
- camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ lst_addrs = solipa_mail_get_addresses_from_string (bcc);
+ if (lst_addrs != NULL)
+ {
+ while (lst_addrs != NULL)
+ {
+ camel_internet_address_add (addr,
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "name"),
+ g_hash_table_lookup ((GHashTable *)lst_addrs->data, "address"));
+ lst_addrs = g_slist_next (lst_addrs);
+ }
+
+ solipa_mail_add_recipient (smail, addr, SOLIPA_MAIL_RECIPIENT_TYPE_BCC);
+ camel_address_remove (CAMEL_ADDRESS (addr), -1);
+ }
}
g_object_unref (addr);