smtp not sending email

I can’t seem to send an email in corona. I’m using smtp by the way. There are no errors but also no mail receive. I remove the “user” from the smtp.send because I don’t know what to put inside. Here are some relevant code:

[code]
local widget = require “widget”
local smtp = require (“socket.smtp”)

function sendmail()

from = “”

rcpt = {
“<”,
}

mesgt = {
body = “Testing 123”
}

r, e = smtp.send{
from = from,
rcpt = rcpt,
source = smtp.message(mesgt),
user = “xxxxxxxxx” – I don’t know what to put here so I just remove this one
password = “xxxxxxxx”,
server = “smtp.gmail.com”,
port = “465”,
}
end

local buttonsend = widget.newButton
{
default = “done.png”,
over = “doneOver.png”,
onRelease = sendmail
}

buttonsend.x = display.contentWidth / 2; buttonsend.y = display.contentHeight / 2
[/code] [import]uid: 189861 topic_id: 34651 reply_id: 334651[/import]

Hello @wwwdotphilip,
Can you please provide some more details about the OS, test device(s), and version of Corona you’re using?

Thanks,
Brent Sorrentino [import]uid: 200026 topic_id: 34651 reply_id: 137734[/import]

I’m using mac OSX lion for my development machine, I used an iPod for testing and Corona Version 2012.894 (2012.8.27) [import]uid: 189861 topic_id: 34651 reply_id: 137797[/import]

Hi again,
Can you download the latest official release of Corona (.971) and see if the issue still occurs? .894 is an older release and many improvements were made in .971. Here’s the link:

https://developer.coronalabs.com/downloads/corona-sdk

Best regards,
Brent
[import]uid: 200026 topic_id: 34651 reply_id: 138007[/import]

Still no email receive. Can you provide me a sample code that works so that I can try it? [import]uid: 189861 topic_id: 34651 reply_id: 138015[/import]

Here’s a couple of things I see that are problematic.

  1. When you say you are not receiving email, you mean at the address you’re sending it too, not the app right? SMTP is for sending emails.

  2. Do you have two < signs or was it a typo when you entered it?

rcpt = { "\<<receiveremail>",<br>}<br>

I’m also assuming you’re replacing the actual email addresses for privacy.

3. In this block of code:
<br>r, e = smtp.send{<br> from = from,<br> rcpt = rcpt, <br> source = smtp.message(mesgt),<br> user = "xxxxxxxxx" -- I don't know what to put here so I just remove this one<br> password = "xxxxxxxx",<br> server = "smtp.gmail.com",<br> port = "465",<br>}<br>

Most SMTP servers require you to login with a username and password to prevent spambots from using their service to spam. Since you are using gmail’s smtp service, this would likely be your personal gmail account and password. This is of course a very dangerous thing to put your email credentials in your app. I don’t know if gmail offers a way to have apps send email through their service like this. If you don’t provide something, it’s not going to work.

Now the last line, port = “465” is also going to stop you. SMTP normally sends on port 25, which is an un-encrypted service. Port 465 is an encrypted port and you would need to use some form of SSL to actually send email through port 465. There are a couple of different email encryption systems in used (TLS is the common one), but I’m pretty sure the socket library does not support SSL.

[import]uid: 199310 topic_id: 34651 reply_id: 138189[/import]

Hello @wwwdotphilip,
Can you please provide some more details about the OS, test device(s), and version of Corona you’re using?

Thanks,
Brent Sorrentino [import]uid: 200026 topic_id: 34651 reply_id: 137734[/import]

I’m using mac OSX lion for my development machine, I used an iPod for testing and Corona Version 2012.894 (2012.8.27) [import]uid: 189861 topic_id: 34651 reply_id: 137797[/import]

Hi again,
Can you download the latest official release of Corona (.971) and see if the issue still occurs? .894 is an older release and many improvements were made in .971. Here’s the link:

https://developer.coronalabs.com/downloads/corona-sdk

Best regards,
Brent
[import]uid: 200026 topic_id: 34651 reply_id: 138007[/import]

Still no email receive. Can you provide me a sample code that works so that I can try it? [import]uid: 189861 topic_id: 34651 reply_id: 138015[/import]

Here’s a couple of things I see that are problematic.

  1. When you say you are not receiving email, you mean at the address you’re sending it too, not the app right? SMTP is for sending emails.

  2. Do you have two < signs or was it a typo when you entered it?

rcpt = { "\<<receiveremail>",<br>}<br>

I’m also assuming you’re replacing the actual email addresses for privacy.

3. In this block of code:
<br>r, e = smtp.send{<br> from = from,<br> rcpt = rcpt, <br> source = smtp.message(mesgt),<br> user = "xxxxxxxxx" -- I don't know what to put here so I just remove this one<br> password = "xxxxxxxx",<br> server = "smtp.gmail.com",<br> port = "465",<br>}<br>

Most SMTP servers require you to login with a username and password to prevent spambots from using their service to spam. Since you are using gmail’s smtp service, this would likely be your personal gmail account and password. This is of course a very dangerous thing to put your email credentials in your app. I don’t know if gmail offers a way to have apps send email through their service like this. If you don’t provide something, it’s not going to work.

Now the last line, port = “465” is also going to stop you. SMTP normally sends on port 25, which is an un-encrypted service. Port 465 is an encrypted port and you would need to use some form of SSL to actually send email through port 465. There are a couple of different email encryption systems in used (TLS is the common one), but I’m pretty sure the socket library does not support SSL.

[import]uid: 199310 topic_id: 34651 reply_id: 138189[/import]