R:250 2.1.3 postmaster@example.com.. sender ok
S:RCPT TO: <postmaster@example.com>
R:250 2.6.2 Address accepted
+S:RCPT TO: <postmaster@example.com>
+R:250 2.6.2 duplicate recipients will be consolidated
S:RCPT TO: <webmaster@example.com>
R:250 2.6.2 Address accepted
#-------------------------------------------------------------------------
{
_Bool success;
+const char *detail;
_Bool proceed;
int phase;
success=false;
+detail="Address accepted";
proceed=true;
phase=0;
while (proceed==true) {
(void) memmove(rcptto,rcptto+1,strlen(rcptto));
break;
case 2 : //Storing rcpt to
- contact->rcptto=(char **)rou_addlist((void **)contact->rcptto,
- (void *)strdup(rcptto));
+ if (eml_addemail(&(contact->rcptto),rcptto)==false) {
+ detail="duplicate recipients will be consolidated";
+ }
break;
case 3 : //everything ok
- (void) transmit(contact,"%d 2.6.2 Address accepted",CMDOK);
+ (void) transmit(contact,"%d 2.6.2 %s",CMDOK,detail);
break;
default : //SAFE guard
proceed=false;
return status;
#undef OPEP
}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to store an email to a list of email */
+/* retune true if successful, false otherwise. */
+/* */
+/********************************************************/
+PUBLIC _Bool eml_addemail(char ***emails,char *email)
+
+{
+_Bool status;
+char **ptr;
+
+status=true;
+ptr=*emails;
+if (ptr!=(char **)0) {
+ while (*ptr!=(char *)0) {
+ if (strcasecmp(*ptr,email)==0) {
+ status=false;
+ break; //already within list
+ }
+ ptr++;
+ }
+ }
+if (status==true)
+ *emails=(char **)rou_addlist((void **)*emails,strdup(email));
+return status;
+}
+
//procedure to close a file within the queue directory
extern int eml_closeqfile(FILE *qfile);
+//procedure to add an email address to a chain
+//of email address
+extern _Bool eml_addemail(char ***emails,char *email);
+
#endif