mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-02-22 08:29:05 +00:00
POP65/SMTP65: Allow port number to be changed in email.cfg
This commit is contained in:
parent
53cc860b89
commit
fdd5daa61f
@ -1,8 +1,8 @@
|
|||||||
192.168.10.2
|
192.168.10.2:110
|
||||||
pi
|
pi
|
||||||
passwordgoeshere
|
passwordgoeshere
|
||||||
NODELETE
|
NODELETE
|
||||||
192.168.10.2
|
192.168.10.2:25
|
||||||
apple2.local
|
apple2.local
|
||||||
/IP65
|
/IP65
|
||||||
/DATA/EMAIL
|
/DATA/EMAIL
|
||||||
|
38
apps/pop65.c
38
apps/pop65.c
@ -42,6 +42,7 @@ char filename[80];
|
|||||||
int len;
|
int len;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
uint32_t filesize;
|
uint32_t filesize;
|
||||||
|
uint16_t pop_port;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keypress before quit
|
* Keypress before quit
|
||||||
@ -293,20 +294,27 @@ void expect(char *buf, char *s) {
|
|||||||
* Read parms from EMAIL.CFG
|
* Read parms from EMAIL.CFG
|
||||||
*/
|
*/
|
||||||
void readconfigfile(void) {
|
void readconfigfile(void) {
|
||||||
fp = fopen("EMAIL.CFG", "r");
|
char *colon;
|
||||||
if (!fp) {
|
fp = fopen("EMAIL.CFG", "r");
|
||||||
puts("Can't open config file EMAIL.CFG");
|
if (!fp) {
|
||||||
error_exit();
|
puts("Can't open config file EMAIL.CFG");
|
||||||
}
|
error_exit();
|
||||||
fscanf(fp, "%s", cfg_server);
|
}
|
||||||
fscanf(fp, "%s", cfg_user);
|
fscanf(fp, "%s", cfg_server);
|
||||||
fscanf(fp, "%s", cfg_pass);
|
fscanf(fp, "%s", cfg_user);
|
||||||
fscanf(fp, "%s", cfg_pop_delete);
|
fscanf(fp, "%s", cfg_pass);
|
||||||
fscanf(fp, "%s", cfg_smtp_server);
|
fscanf(fp, "%s", cfg_pop_delete);
|
||||||
fscanf(fp, "%s", cfg_smtp_domain);
|
fscanf(fp, "%s", cfg_smtp_server);
|
||||||
fscanf(fp, "%s", cfg_instdir);
|
fscanf(fp, "%s", cfg_smtp_domain);
|
||||||
fscanf(fp, "%s", cfg_emaildir);
|
fscanf(fp, "%s", cfg_instdir);
|
||||||
fclose(fp);
|
fscanf(fp, "%s", cfg_emaildir);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
colon = strchr(cfg_smtp_server, ':');
|
||||||
|
if (!colon)
|
||||||
|
pop_port = 110;
|
||||||
|
else
|
||||||
|
pop_port = atoi(colon + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -515,7 +523,7 @@ void main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
printf("Ok\nConnecting to %s - ", cfg_server);
|
printf("Ok\nConnecting to %s - ", cfg_server);
|
||||||
|
|
||||||
if (!w5100_connect(parse_dotted_quad(cfg_server), 110)) {
|
if (!w5100_connect(parse_dotted_quad(cfg_server), pop_port)) {
|
||||||
printf("Fail\n");
|
printf("Fail\n");
|
||||||
error_exit();
|
error_exit();
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ char filename[80];
|
|||||||
int len;
|
int len;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
uint32_t filesize;
|
uint32_t filesize;
|
||||||
|
uint16_t smtp_port;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keypress before quit
|
* Keypress before quit
|
||||||
@ -329,21 +330,28 @@ uint8_t expect(char *buf, char *s) {
|
|||||||
* Read parms from EMAIL.CFG
|
* Read parms from EMAIL.CFG
|
||||||
*/
|
*/
|
||||||
void readconfigfile(void) {
|
void readconfigfile(void) {
|
||||||
fp = fopen("EMAIL.CFG", "r");
|
char *colon;
|
||||||
if (!fp) {
|
fp = fopen("EMAIL.CFG", "r");
|
||||||
puts("Can't open config file EMAIL.CFG");
|
if (!fp) {
|
||||||
error_exit();
|
puts("Can't open config file EMAIL.CFG");
|
||||||
}
|
error_exit();
|
||||||
fscanf(fp, "%s", cfg_server);
|
}
|
||||||
fscanf(fp, "%s", cfg_user);
|
fscanf(fp, "%s", cfg_server);
|
||||||
fscanf(fp, "%s", cfg_pass);
|
fscanf(fp, "%s", cfg_user);
|
||||||
fscanf(fp, "%s", cfg_pop_delete);
|
fscanf(fp, "%s", cfg_pass);
|
||||||
fscanf(fp, "%s", cfg_smtp_server);
|
fscanf(fp, "%s", cfg_pop_delete);
|
||||||
fscanf(fp, "%s", cfg_smtp_domain);
|
fscanf(fp, "%s", cfg_smtp_server);
|
||||||
fscanf(fp, "%s", cfg_instdir);
|
fscanf(fp, "%s", cfg_smtp_domain);
|
||||||
fscanf(fp, "%s", cfg_emaildir);
|
fscanf(fp, "%s", cfg_instdir);
|
||||||
fscanf(fp, "%s", cfg_emailaddr);
|
fscanf(fp, "%s", cfg_emaildir);
|
||||||
fclose(fp);
|
fscanf(fp, "%s", cfg_emailaddr);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
colon = strchr(cfg_smtp_server, ':');
|
||||||
|
if (!colon)
|
||||||
|
smtp_port = 25;
|
||||||
|
else
|
||||||
|
smtp_port = atoi(colon + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -521,7 +529,7 @@ void main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
printf("Ok\nConnecting to %s - ", cfg_smtp_server);
|
printf("Ok\nConnecting to %s - ", cfg_smtp_server);
|
||||||
|
|
||||||
if (!w5100_connect(parse_dotted_quad(cfg_smtp_server), 25)) {
|
if (!w5100_connect(parse_dotted_quad(cfg_smtp_server), smtp_port)) {
|
||||||
printf("Fail\n");
|
printf("Fail\n");
|
||||||
error_exit();
|
error_exit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user