Alright ya'll. I may have found another issue, but maybe it's just me.
Arising from the loop idea that was brought up as a temporary workaround-
if curl_slist_free_all is called and I loop around and add a recipient to the same slist I just free all'ed, it creates an infinitely linked list- so you need to append to a NULL slist (see attached example).

Could someone tell me why the value from curl_easy_perform() on an invalid address returns CURLE_LOGIN_DENIED and verify that it is unique from invalid login information? It seems to me that this is probably not an accurate error code, since to my limited understanding of mail servers, it is possible to be required to Login to a mail server to send mail. (though this would also prevent the recipient from receiving the email in question- it would just be more difficult to trace the real problem with sending that email)

By the way- thanks for your attention to the last issue. I appreciate it.



// you will have to rework this a little bit- I just whipped it up to share.

void mailTHIS(char * url, CURL * curl){

CURLcode res;
struct curl_slist *recipients = NULL;
struct curl_slist *noRecipients = NULL;
struct upload_status upload_ctx;

char *recipientlist[]={"populate", "the", "list"}
int numRecipients = 3; 

upload_ctx.lines_read=0;

if(curl){

        curl_easy_setopt(curl, CURLOPT_URL, url);

        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

        curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);

        curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);

        curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);

        int i=0;
        while(i<numRecipients){


                // this line is the workaround. 
                recipients = curl_slist_append(noRecipients, recipientlist[i]);

                //The following line will infinitely loop if you comment out 
the above. 
                // recipients = curl_slist_append(recipients, recipientlist[i]);
                

                curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
                res  = curl_easy_perform(curl);
                
                if(res == CURLE_LOGIN_DENIED){
                        //this is where you could keep track of bad addresses
                        
                        }
                curl_slist_free_all(recipients);

                i++; 
                }
        }
}

int __cdecl main(void){
char* url = ###SERVERHERE;
CURL *curl = curl_easy_init( );
mailTHIS(url, curl);
curl_easy_cleanup(curl);
return 0;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to