1
votes

I am sending SMS text messages via email by using each mobile phone carrier's address (for example, verizon is '[email protected]').

However, there are two problems:

1) send_mail requires a 'subject' and a 'from email'. When the text is received, the subject, which is unnecessary and just uses up precious characters in the message, appears in parentheses in the text message, before the message body. I have tried to set subject=None, but then I just get (None) as the subject. Any idea how I can get rid of the subject or not use it when sending using send_mail?

2) the from_email causes the SMS message to report that it's coming from 'bounces+246181-....', i assume because it doesn't know what to do with the from_email field, or because it doesn't match. If I send an SMS message directly from my email client, it correctly reports the sender. Any idea how to get rid of the "bounces..."

here's an example:

from django.core.mail import send_mail
subject = None
message = 'testing 123'
from_email = '[email protected]'
to = '4041111111'

send_mail(subject,message,from_email,to,fail_silently=False)

Thanks!

* NEW INFORMATION

I found out that the problem with the "bounce" string was related to a conflict between using sendgrid to send emails and sending them to the verizon carrier. Sendgrid, by default, messes with the sender information (this can be disabled). This screwed up the "from" information displayed on the received text. disabling this with sendgrid fixed the problem.

1
have you considered actually sending SMS direct to a phone number? I've used django-sendsms along with a Twilio account. Twilio is not free though (without a "watermark")j_syk
I have been using twilio, and the reason I'm moving away from it is because it is not free.mb52089

1 Answers

2
votes

I tested the following

from django.core.mail import send_mail
send_mail('','test','',['my_number@mynetwork'])

and I received this text:

FRM:[email protected]
MSG:test

So you can keep the subject as an empty string to keep the subject from showing.