Well I think I posted about this before but I wasn't sure if it got through but the problem was that in windows msvc++ 5.0 in windows I can't send more than one string. The following is the code from my function anyone got any ideas? (just for information I have localhost as the mail server because I've set up my own e-mail server) Code: (some of the lines might get cut off because of the size of window you are using is too small. Just maximize the window) int sendcmd (int handel, char *line, struct char_data *ch) { int bytessent, length, position = 0, a, b, c; char *buf, *buf2; length = strlen(line); buf = line; { bytessent = send(handel, buf, strlen(buf), 0); if (bytessent == -1) return -1; else if (bytessent != strlen(buf)){ b = 0; position += (bytessent + 1); for (a = (bytessent + 1); a < strlen(buf); a++, b++) { buf2[b] = buf[a]; } buf2[b + 1] = '\0'; buf = buf2; c = -1; } else { c = bytessent; } } while (c == -1); return (c); } ACMD(do_imail) { int sockfd, temp1; struct sockaddr_in dest_addr; char *hostname = "localhost"; int port = 25; struct hostent *he; char *string1, *string2, *string3, *string4, *string5, *string6; string1 = "helo triplethreat.dyn.ml.org\r\n"; string2 = "mail from:circle@triplethreat.dyn.ml.org\r\n"; string3 = "rcpt to:modem-burn@geocities.com\r\n"; string4 = "data\r\n"; string5 = "tempdata body message\r\n"; string6 = ".\r\n"; one_argument(argument, arg); if (!*arg) { send_to_char("Who would you like to E-Mail?\r\n", ch); return; } if ((he=gethostbyname(hostname)) == NULL) { send_to_char("Host Name error. Does not exist.\r\n", ch); return; } if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { send_to_char("Sorry, the socket was not avalible, perhaps another person is just in the process of mailing.\r\n", ch); return; } dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); dest_addr.sin_addr = *((struct in_addr *)he->h_addr); memset((unsigned char *)&dest_addr.sin_zero, 0, sizeof(unsigned char *)); /*connect socket to remote host*/ if (connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr_in)) == -1) { sprintf(buf, "Connection error. Report exact error to admin and the followind number: %d/r/r", WSAGetLastError()); send_to_char(buf, ch); return; } if ((sendcmd(sockfd, string1, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } if ((sendcmd(sockfd, string2, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } if ((sendcmd(sockfd, string3, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } if ((sendcmd(sockfd, string4, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } if ((sendcmd(sockfd, string5, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } if ((sendcmd(sockfd, string6, ch)) == -1) { send_to_char("Error while sending. Contact an administrator.\r\n", ch); return; } close(sockfd); send_to_char("As you wish!\r\n", ch); return; } +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST