Well right now I'm trying to set up an internal e-mail system as the
other methods recently mentioned are unreliiable. It works like the
following:
(This source is very messy because I am in the process of debugging)
any it should work fine! But I get a connect error all the time. the
host is correct. I was thinking it was possibly the port but I tried
using it on my own mud on port 4000 it still had connect problems. Any
ideas? O am trying to connect to port 25. and send string 1 -6.
Eventually this will have a second argument for the subject and will
then used advanced text editor for the body but until I get the damb
thing to connect nothing else matters. So the connect function is
returning -1 like it's supose to do on error. Help would be apreciated.
Oh and I'm using win 95, msvc++ 5.0.
ACMD(do_imail)
{
int sockfd, temp1;
struct sockaddr_in dest_addr;
char *string1;
char *string2;
char *string3;
char *string4;
char *string5;
char *string6;
int j, sent;
struct hostent *he;
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 = "hi hi buble hi\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("mail.crcssd1.calgary.ab.ca")) == NULL) {
send_to_char("Host Name error", 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 = PF_INET;
dest_addr.sin_port = htons(DEST_PORT);
dest_addr.sin_addr = *((struct in_addr *)he->h_addr);
// bzero(&(dest_addr.sin_zero), 8);
memset((char *)&dest_addr, 0, sizeof(dest_addr));
/*connect socket to remote host*/
if (connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct
sockaddr)) == -1)
{
send_to_char("connect error", ch);
return;
}
send(sockfd, string1, strlen(string1), 0);
send(sockfd, string2, strlen(string2), 0);
send(sockfd, string3, strlen(string3), 0);
send(sockfd, string4, strlen(string4), 0);
send(sockfd, string5, strlen(string5), 0);
send(sockfd, string6, strlen(string6), 0);
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