- Add MIME-Version header to email messages outgoing
- check for short code in globalsender before checking if local recipient
This commit is contained in:
parent
79b19bac64
commit
88de7ef670
|
@ -3165,16 +3165,16 @@ is discarded and the sender notified via delivery report.
|
|||
<li> If the message is due for delivery attempt, the global sender
|
||||
determines, for each recipient, how to deliver the message:
|
||||
<ol type="a">
|
||||
<li> If the message is destined for a local MMS client, the message
|
||||
is transferred to the mobile/local queue. A copy of the message is
|
||||
sent (as MIME) to the MMBox host (if one is configured)
|
||||
<li> If the message is destined for an email user, the message is
|
||||
re-formatted as MIME, sender and recipient addresses normalised as RFC
|
||||
822 addresses, and the message passed to the mailer.
|
||||
<li> If the message is destined for a foreign gateway, it is coded
|
||||
as MIME and passed to the mailer for delivery via SMTP
|
||||
<li>If the the message is destined for a VASP (identified by short
|
||||
code), then it is sent using MM7 protocols to the relevant VASP.
|
||||
<li> If the message is destined for a local MMS client, the message
|
||||
is transferred to the mobile/local queue. A copy of the message is
|
||||
sent (as MIME) to the MMBox host (if one is configured)
|
||||
<li> If the message is destined for a foreign gateway, it is coded
|
||||
as MIME and passed to the mailer for delivery via SMTP
|
||||
<li> If the message cannot be delivered, the sender is notified.
|
||||
</ol>
|
||||
</ol>
|
||||
|
|
|
@ -645,6 +645,9 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
|
|||
http_header_add(newhdrs, "From", octstr_get_cstr(from));
|
||||
http_header_add(newhdrs, "To", octstr_get_cstr(to));
|
||||
http_header_add(newhdrs, "Message-ID", msgid ? octstr_get_cstr(msgid) : "");
|
||||
|
||||
http_header_add(newhdrs, "MIME-Version", "1.0");
|
||||
|
||||
http_header_combine(newhdrs, m->headers);
|
||||
http_destroy_headers(m->headers);
|
||||
m->headers = newhdrs;
|
||||
|
|
|
@ -207,66 +207,69 @@ static int sendMsg(MmsEnvelope *e)
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Normalise the number, then see if we can resolve home MMSC for this recipient. */
|
||||
normalize_number(octstr_get_cstr(settings->unified_prefix), &phonenum);
|
||||
|
||||
if ((mmsc = settings->mms_resolvefuncs->mms_resolve(phonenum,
|
||||
settings->mms_resolver_module_data,
|
||||
settings, proxyrelays))) {
|
||||
info(0, "mmsc for \"%s\" resolved to: \"%s\"",
|
||||
octstr_get_cstr(phonenum), octstr_get_cstr(mmsc));
|
||||
|
||||
if (octstr_compare(mmsc, settings->hostname) == 0) {
|
||||
if (settings->mms2mobile) { /* Send a copy to this VASP. */
|
||||
Octstr *xerr = NULL;
|
||||
int res = mms_sendtovasp(settings->mms2mobile,
|
||||
e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
info(0, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - "
|
||||
"From %s, to %s, msgsize=%ld: err=%s",
|
||||
SEND_ERROR_STR(res),
|
||||
octstr_get_cstr(settings->mms2mobile->id),
|
||||
octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize,
|
||||
xerr ? octstr_get_cstr(xerr) : "(null)");
|
||||
if (xerr)
|
||||
octstr_destroy(xerr);
|
||||
}
|
||||
|
||||
res = mms_sendtomobile(e->from, to->rcpt,
|
||||
e->subject, e->fromproxy,
|
||||
e->msgId, e->expiryt, msg, e->dlr,
|
||||
&err);
|
||||
/* Search VASP list, see what you can find... */
|
||||
for (j = 0, m = list_len(settings->vasp_list); j < m; j++)
|
||||
if ((vasp = list_get(settings->vasp_list, j)) != NULL &&
|
||||
_x_octstr_int_compare(vasp->short_code, phonenum) == 0) {
|
||||
res = mms_sendtovasp(vasp, e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
sent = 1;
|
||||
} else if (proxyrelays && list_len(proxyrelays) > 0) /* Step through proxies. */
|
||||
for (j = 0, m = list_len(proxyrelays); j<m; j++) {
|
||||
MmsProxyRelay *mp = list_get(proxyrelays, j);
|
||||
|
||||
if (!octstr_compare(mp->host, mmsc)) {
|
||||
res = mms_sendtoproxy(e->from, to->rcpt,
|
||||
e->subject, mp->host,
|
||||
e->msgId, e->expiryt, msg,
|
||||
e->dlr, &err);
|
||||
sent = 1;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sent != 1) { /* Not yet, sent, find the receiver MMSC. */
|
||||
/* Normalise the number, then see if we can resolve home MMSC for this recipient. */
|
||||
normalize_number(octstr_get_cstr(settings->unified_prefix), &phonenum);
|
||||
|
||||
if ((mmsc = settings->mms_resolvefuncs->mms_resolve(phonenum,
|
||||
settings->mms_resolver_module_data,
|
||||
settings, proxyrelays))) {
|
||||
info(0, "mmsc for \"%s\" resolved to: \"%s\"",
|
||||
octstr_get_cstr(phonenum), octstr_get_cstr(mmsc));
|
||||
|
||||
if (octstr_compare(mmsc, settings->hostname) == 0) {
|
||||
if (settings->mms2mobile) { /* Send a copy to this VASP. */
|
||||
Octstr *xerr = NULL;
|
||||
int res = mms_sendtovasp(settings->mms2mobile,
|
||||
e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
info(0, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - "
|
||||
"From %s, to %s, msgsize=%ld: err=%s",
|
||||
SEND_ERROR_STR(res),
|
||||
octstr_get_cstr(settings->mms2mobile->id),
|
||||
octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize,
|
||||
xerr ? octstr_get_cstr(xerr) : "(null)");
|
||||
if (xerr)
|
||||
octstr_destroy(xerr);
|
||||
}
|
||||
}
|
||||
octstr_destroy(mmsc);
|
||||
} else /* Search VASP list, see what you can find... */
|
||||
for (j = 0, m = list_len(settings->vasp_list); j < m; j++)
|
||||
if ((vasp = list_get(settings->vasp_list, j)) != NULL &&
|
||||
_x_octstr_int_compare(vasp->short_code, phonenum) == 0) {
|
||||
res = mms_sendtovasp(vasp, e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
|
||||
res = mms_sendtomobile(e->from, to->rcpt,
|
||||
e->subject, e->fromproxy,
|
||||
e->msgId, e->expiryt, msg, e->dlr,
|
||||
&err);
|
||||
sent = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (proxyrelays && list_len(proxyrelays) > 0) /* Step through proxies. */
|
||||
for (j = 0, m = list_len(proxyrelays); j<m; j++) {
|
||||
MmsProxyRelay *mp = list_get(proxyrelays, j);
|
||||
|
||||
if (!octstr_compare(mp->host, mmsc)) {
|
||||
res = mms_sendtoproxy(e->from, to->rcpt,
|
||||
e->subject, mp->host,
|
||||
e->msgId, e->expiryt, msg,
|
||||
e->dlr, &err);
|
||||
sent = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
octstr_destroy(mmsc);
|
||||
}
|
||||
}
|
||||
if (!sent) {
|
||||
res = MMS_SEND_ERROR_FATAL;
|
||||
err = octstr_format("MMSC error: Don't know how to deliver to %S !", to->rcpt);
|
||||
|
||||
|
||||
}
|
||||
if (phonenum) octstr_destroy(phonenum);
|
||||
}
|
||||
|
@ -275,7 +278,7 @@ static int sendMsg(MmsEnvelope *e)
|
|||
if (res == MMS_SEND_OK)
|
||||
to->process = 0;
|
||||
else { /* If there was a report request, queue it. */
|
||||
|
||||
|
||||
if (e->dlr) {
|
||||
Octstr *qfs;
|
||||
MmsMsg *m = mms_deliveryreport(e->msgId, to->rcpt, tnow,
|
||||
|
|
Loading…
Reference in New Issue